I batch tested both versions - the one with "require" and the one with "use" - 1000 times each (just to be sure, I did not miss any race conditions). The result is: The code with "require" works 100%, the code with "use" never works - even though the module is loaded at the very beginning and not in every thread separately. This cannot be a coincidence.

Jerry D. Hedden wrote:
Sebastian Weber wrote:
I tested around a little bit and found, that just using "require Socket;import Socket ':all';" instead of "use Socket;" solves the problem.

It was probably a coincidence that your code worked.  Loading
non-thread-safe modules should be done separately in the child threads
and main thread (after launching the child threads) so that neither
copy interferes with the other.

                
___________________________________________________________ Telefonate ohne weitere Kosten vom PC zum PC: http://messenger.yahoo.de

Reply via email to