| 1 |
% Generated by roxygen2: do not edit by hand |
| 2 |
% Please edit documentation in R/socket.R |
| 3 |
\name{monitor} |
| 4 |
\alias{monitor} |
| 5 |
\alias{read_monitor} |
| 6 |
\title{Monitor a Socket for Pipe Changes} |
| 7 |
\usage{ |
| 8 |
monitor(sock, cv) |
| 9 |
|
| 10 |
read_monitor(x) |
| 11 |
} |
| 12 |
\arguments{ |
| 13 |
\item{sock}{a Socket.} |
| 14 |
|
| 15 |
\item{cv}{a 'conditionVariable'.} |
| 16 |
|
| 17 |
\item{x}{a Monitor.} |
| 18 |
} |
| 19 |
\value{ |
| 20 |
For \code{monitor}: a Monitor (object of class 'nanoMonitor'). \cr |
| 21 |
For \code{read_monitor}: an integer vector of pipe IDs (positive if added, |
| 22 |
negative if removed), or else NULL if there were no changes since the |
| 23 |
previous read. |
| 24 |
} |
| 25 |
\description{ |
| 26 |
This function monitors pipe additions and removals from a socket. |
| 27 |
} |
| 28 |
\examples{ |
| 29 |
cv <- cv() |
| 30 |
s <- socket("poly") |
| 31 |
s1 <- socket("poly") |
| 32 |
|
| 33 |
m <- monitor(s, cv) |
| 34 |
m |
| 35 |
|
| 36 |
listen(s) |
| 37 |
dial(s1) |
| 38 |
|
| 39 |
cv_value(cv) |
| 40 |
read_monitor(m) |
| 41 |
|
| 42 |
close(s) |
| 43 |
close(s1) |
| 44 |
|
| 45 |
read_monitor(m) |
| 46 |
|
| 47 |
} |