in reply to dereferencing IO::Socket::INET from a thread

Couldn't you just save the clients as a hash keyed by $thr instead of as an array? I would think that this would take care of your problem by tracking the information in the main thread as opposed to getting it back from each of the individual threads.

Replies are listed 'Best First'.
Re: Re: dereferencing IO::Socket::INET from a thread
by zentara (Cardinal) on Nov 21, 2003 at 16:40 UTC
    Yes, I've done it that way, with a %thr hash, and it works like you suggest. But it only works from the main program. What I'm eventually aiming at is to print to the other threads from a thread. When I try to use threads::shared on @clients or %thrs, and try to access them from each thread, each thread dosn't see a thread created after it was created. But each thread will return the same list if I call threads->list. But here's the gotcha, the list returned in each thread from threads->list, is of the form in @thrs , which presents the same dereferencing problem, which I'm asking. I hope I made sense.