Prevents further pipe connections from being established at a Socket.
lock(socket, cv = NULL)
unlock(socket)
a Socket.
(optional) a 'conditionVariable'. If supplied, the socket is locked only while the value of the condition variable is non-zero.
Invisibly, zero on success (will otherwise error).
s <- socket("bus", listen = "inproc://nanolock")
s1 <- socket("bus", dial = "inproc://nanolock")
lock(s)
s2 <- socket("bus", dial = "inproc://nanolock")
send(s, "test")
#> [1] 0
recv(s1)
#> [1] "test"
recv(s2)
#> 'errorValue' int 8 | Try again
unlock(s)
s3 <- socket("bus", dial = "inproc://nanolock")
send(s, "test")
#> [1] 0
recv(s1)
#> [1] "test"
recv(s3)
#> [1] "test"
close(s)
close(s1)
close(s2)
close(s3)