in reply to How to break up a long running process
T'is easy.
#!/usr/bin/perl -w use IO::Socket; use strict; use threads; use threads::shared; #sock is my connection where I report what is going on my $sock = IO::Socket::INET->new( PeerAddr => 'hostname.org', PeerPort => '1234', Proto => 'tcp' ); my $done:shared = 0; my $thread = async{ long_running_function(); $done = 1 }; print $sock "I'm still here" and sleep 180 until $done; my $return_value = $thread->join; print $sock "$return_value\n"; close $sock;
|
|---|