in reply to using TCP as a resource lock: should I do this?
That'll be a little gentler as sleep doesn't spin in a tight loop.while (++$num_tries < 10) { if( $lock = IO::Socket::INET->new(Proto => "tcp", PeerAddr => $server, PeerPort => $port) ) { $lock->autoflush(1); last; } sleep 1; # wait a second, don't tie up the CPU }
Any errors in logic or code should be excused as I'm still jet lagged.
|
|---|