Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Failing tests of Test::TCP on Windows

by Corion (Patriarch)
on Mar 05, 2013 at 09:56 UTC ( [id://1021786]=note: print w/replies, xml ) Need Help??


in reply to Failing tests of Test::TCP on Windows

IMO, trying to mix sockets and fork on Windows is fraught with problems. It's great when it works, but usually when external communication or sharing of resources gets involved (like with sockets), the problems outweigh the perceived benefits, especially in a Test:: module.

Replies are listed 'Best First'.
Re^2: Failing tests of Test::TCP on Windows
by bojinlund (Monsignor) on Mar 06, 2013 at 07:55 UTC

    corion thanks for the answer!

    I suppose that “sharing of resources” in your answer means sharing resources between threads within one Windows process.

    As threads is implemented using Windows threads, it has then the same problems as fork!? My conclusion is then that you need two Windows process to test a TCP-connection. Or is there any other possibility to use threads?

    I have difficulties to understand what you should avoid using threads in Windows. Are there any documentation explaining threads in Windows from a Perl perspective? Which type of resources are problematic to shared between Windows threads?

      The semantics of threads are far easier to reason about, as closing a handle in one thread will close the handle for the complete process for example. When using fork(), this would be unexpected, but when using the fork emulation on Windows, the same happens. This is obvious when you keep in mind that on Windows, fork emulation is implemented through threads, but programmers using fork() do usually not come from Windows and don't think of fork behaving differently.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1021786]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (4)
As of 2024-04-24 04:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found