[Win32utils-devel] Asynchronous Pipe::Server problems
Park Heesob
phasis at gmail.com
Tue May 20 11:11:50 EDT 2008
Hi,
----- Original Message -----
From: "Berger, Daniel" <Daniel.Berger at qwest.com>
To: "Development and ideas for win32utils projects" <win32utils-devel at rubyforge.org>
Sent: Wednesday, May 21, 2008 12:06 AM
Subject: Re: [Win32utils-devel] Asynchronous Pipe::Server problems
> Hi,
>
>> -----Original Message-----
>> From: win32utils-devel-bounces at rubyforge.org
>> [mailto:win32utils-devel-bounces at rubyforge.org] On Behalf Of
>> Park Heesob
>> Sent: Tuesday, May 20, 2008 8:25 AM
>> To: Development and ideas for win32utils projects
>> Subject: Re: [Win32utils-devel] Asynchronous Pipe::Server problems
>
> <snip>
>
>> >
>> > 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?
>> >
>> The problem is due to the reconnect method.
>> The solution is define disconnect as DisconnectNamedPipe
>> ,close as before
>> and modify
>>
>> def reconnect
>> close
>> mainloop
>> end
>>
>> to
>>
>> def reconnect
>> disconnect
>> mainloop
>> end
>
> Just to clarify, we want this in pipe.rb then?
>
Yes, of course.
> def disconnect
> DisconnectNamedPipe(@pipe)
> end
>
> def close
> CloseHandle(@pipe)
> end
>
close on server.rb could be
def close
FlushFileBuffers(@pipe)
DisconnectNamedPipe(@pipe)
CloseHandle(@pipe)
end
Regards,
Park Heesob
More information about the win32utils-devel
mailing list