Learn R Programming

nanonext (version 1.4.0)

monitor: Monitor a Socket for Pipe Changes

Description

This function monitors pipe additions and removals from a socket.

Usage

monitor(sock, cv)

read_monitor(x)

Value

For monitor: a Monitor (object of class 'nanoMonitor').

For read_monitor: an integer vector of pipe IDs (positive if added, negative if removed), or else NULL if there were no changes since the previous read.

Arguments

sock

a Socket.

cv

a conditionVariable.

x

an external pointer to a monitor.

Examples

Run this code
cv <- cv()
s <- socket("poly")
s1 <- socket("poly")

m <- monitor(s, cv)
m

listen(s)
dial(s1)

cv_value(cv)
read_monitor(m)

close(s)
close(s1)

read_monitor(m)

Run the code above in your browser using DataLab