lock {nanonext} | R Documentation |
Lock / Unlock a Socket
Description
Prevents further pipe connections from being established at a Socket. If a socket is locked, new pipe connections are closed before they can be added to the socket.
Usage
lock(socket, cv = NULL)
unlock(socket)
Arguments
socket |
a Socket. |
cv |
(optional) a ‘conditionVariable’. If supplied, the socket is
locked only whilst the condition variable is an odd value. This is
designed to allow an initial connection, as well as subsequent
re-connections after a connection has ended, if the conditon variable is
also registered with |
Value
Invisibly, zero on success (will otherwise error).
Examples
s <- socket("bus", listen = "inproc://nanolock")
s1 <- socket("bus", dial = "inproc://nanolock")
lock(s)
s2 <- socket("bus", dial = "inproc://nanolock")
send(s, "test")
recv(s1)
recv(s2)
unlock(s)
s3 <- socket("bus", dial = "inproc://nanolock")
send(s, "test")
recv(s1)
recv(s3)
close(s)
close(s1)
close(s2)
close(s3)
[Package nanonext version 1.1.1 Index]