[Win32utils-devel] Asynchronous Pipe::Server problems
djberg96 at gmail.com
Tue May 20 07:45:46 EDT 2008
Heesob Park wrote:
> 2008/5/20 Daniel Berger <djberg96 at gmail.com>:
>> Heesob Park wrote:
>>> 2008/5/20 Daniel Berger <djberg96 at gmail.com>:
>>>> Hi all,
>> However, I've botched something else up. I started up the
>> test_async_server.rb program in one terminal, then ran the
>> test_client_async.rb program. The first time it works on the client side:
>> # Client side
>> pipe client is running
>> Got [Ruby rocks!] back from server
>> Though I see nothing on the server side.
>> The second time I run the client it just hangs.
>> I fixed something in the Pipe#wait method (so update from CVS) but that
>> didn't solve it.
>> Any ideas?
> Here is the patch for pipe.rb and server.rb:
> --- win32-pipe/lib/win32/pipe.rb 2008-05-20 14:10:30.000000000 +0900
> +++ pipe.rb 2008-05-20 17:07:53.000000000 +0900
> @@ -62,7 +61,7 @@
> def close
> - CloseHandle(@pipe)
> + # CloseHandle(@pipe)
I can see why we don't do this now, but I wonder if we should do this in
a finalizer, along with a call to FlushFileBuffers(). All the example
code I see closes the handle. Perhaps I'm being overly paranoid about
handle leaks, though.
I'm also thinking about adding a block form that would automatically
ensure a call to Pipe#close.
What do you think?
More information about the win32utils-devel