Last active
August 29, 2015 14:16
-
-
Save calid/2bd0d3aec4598a1257e5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use Sys::SigAction qw(timeout_call); | |
my $timed_out = timeout_call 3, sub { # schedules SIGALRM | |
my $ctx = ZMQ::FFI->new(); | |
my $s = $ctx->socket(ZMQ_REQ); | |
$s->connect("ipc:///tmp/test-zmq-ffi-$$"); | |
$s->send('ohhai'); | |
$s->close(); # bug here, linger not set | |
$ctx->destroy(); # hangs, SIGALRM breaks the hang | |
# end of scope, socket/ctx DEMOLISH triggers.. hangs again! woops | |
}; | |
# never gets here | |
ok !$timed_out, 'implicit Socket cleanup done correctly (does not hang)'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment