Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
this code gives me the error - Argument to share needs to be passed as ref. Am I doing something stupid or is it not possible to share a socket between threads. Thanks.package Foo; use threads; use threads::shared; sub new { my $class = shift; my $self : shared; $self = &share({}); $self->{socket} = &share(new IO::Socket::INET ( PeerAddr => $self->{ipAddress}, PeerPort => $self->{port}, Proto => 'tcp' )); bless $self, $class; return $self
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Sharing sockets between threads
by zentara (Cardinal) on Mar 19, 2009 at 11:49 UTC | |
by Anonymous Monk on Mar 19, 2009 at 13:30 UTC | |
by zentara (Cardinal) on Mar 19, 2009 at 15:09 UTC |