in reply to Threaded UDP Communication
Note that this is code is untested, but I'm sure it works because I've got production code like this at work. Actually, it's slightly different, the thread creation doesn't use the "standard parameter passing procedure", so although I can't guarantee the above will work, I'm completely sure that this works:use warnings; use strict; use threads; use IO::Socket; my $socket = IO::Socket::INET->new(); # pass your parameters threads->create(\&do_stuff, $socket); sleep(0xffffffff); # ;-) sub do_stuff { my ($socket) = @_; # play happily ever after with $socket in your new thread }
But I guess it should work both ways.threads->create(sub { do_stuff($socket) });
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Threaded UDP Communication
by valhalla418 (Novice) on Feb 17, 2006 at 13:36 UTC | |
by valhalla418 (Novice) on Feb 17, 2006 at 15:41 UTC | |
|
Re^2: Threaded UDP Communication
by BrowserUk (Patriarch) on Feb 25, 2006 at 09:05 UTC |