in reply to Re: Preventing IO::Handles from closing on destruction
in thread Preventing IO::Handles from closing on destruction

Fair enough. I tried implementing this and hit an unexpected problem. The close() call in worker thread does not actually close the socket. The connection does not actually close until the preserved file handle in the main thread goes out of scope. Unfortunately, this is after the next connection comes in, as the main thread is block in accept() ... no non blocking calls on w32 AFAIK. Any thoughts on how to force the duplicated socket to close?
  • Comment on Re^2: Preventing IO::Handles from closing on destruction

Replies are listed 'Best First'.
Re^3: Preventing IO::Handles from closing on destruction
by Eliya (Vicar) on Nov 04, 2011 at 15:55 UTC

    On Unix, I would try POSIX::close($fileno), which operates directly on descriptor numbers (not handles).  Not sure if that works on Windows, though, or what the equivalent would be...

      POSIX::close() did the trick. Thanks a bunch!