sunshine_august has asked for the wisdom of the Perl Monks concerning the following question:
Hi, monks:
I am trying to write a server based on Http::Daemon,
and want the main thread to accept the client connections,
and then pass these client connections to the serveral
worker threads to handle, but how can I pass these client
connections to the worker threads that have been created
before?
Originally, I thought I can pass these client
coneections by a shared array, but when I try to "push
@clientConnections, share_clone( $client )", the
share_clone subroutin gives me an "Unsupported type of
'GLOB'" error message. Yes,it can't share the socket
descriptor.
...
my @clientConnections : shared;
# several worker threads
threads->create( \&handleClients, ( \@clientConnections ) );
while ( my $client = $httpd->accept) {
push @clientConnections, share_clone( $client );
}
sub handleClients
{
...
}
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How to pass client connections to the worker threads?
by zentara (Cardinal) on Sep 10, 2008 at 12:12 UTC | |
by sunshine_august (Scribe) on Sep 11, 2008 at 02:29 UTC | |
by zentara (Cardinal) on Sep 11, 2008 at 13:39 UTC | |
|
Re: How to pass client connections to the worker threads?
by sunshine_august (Scribe) on Sep 10, 2008 at 10:45 UTC | |
by betterworld (Curate) on Sep 10, 2008 at 12:30 UTC | |
by sunshine_august (Scribe) on Sep 11, 2008 at 02:19 UTC | |
|
Re: How to pass client connections to the worker threads?
by Anonymous Monk on Sep 10, 2008 at 05:09 UTC | |
by sunshine_august (Scribe) on Sep 10, 2008 at 05:45 UTC |