Try what was suggested to me by Steadman with:

$foo = &shared({});  

Then assign your $s.

David

[EMAIL PROTECTED] wrote:

> I'm trying to run a network server that uses iThreads. Here is the general
idea
> of how I think the process flow should go:

> Application sets up a pool of n threads.
> Connection goes to socket. 
> The socket is queued somehow (using Thread::Queue, or some such mechanism).
> Free thread in the pool gets the socket from the queue and does what it needs
> to do with it.

> Well, this doesn't seem to work at all. Thread::Queue won't enqueue the
socket
> ref (I'll just use $s from here for simplicity). I've tried somehow using
> an arbitrary number in a hash and queue that instead - like: $foo{$bar} = $s,
> and that fails too. I'm getting the oh-so-useful "invalid data for shared 
> scalar" error message. 

> I've also tried setting up a pool of threads all waiting for socket
connections
> in sort of a first-come-first-serve form, but that just doesn't work at all.
> While setting up a network server using fork() is very easy, it is also 
> inherently unreliable and I'm trying to set up a better and more elegant  
> solution using threads, however I'm running into a brick wall here.

> Does anybody have any ideas or suggestions?


Reply via email to