This is the mail archive of the
cygwin-developers@cygwin.com
mailing list for the Cygwin project.
Re: cygthread::cygthread() hang
On Fri, Apr 11, 2003 at 10:45:35AM -0400, Joe Buehler wrote:
>Christopher Faylor wrote:
>>...and there is still a much slower memory leak. I inadvertantly left
>>a test process running and came back to XP informing me that I didn't
>>have enough virtual memory. The test program had allocated a lot of
>>space after 24 hours of once a second interrupts of a pipe read. I
>>don't know where the space is being used since the thread stack base
>>obviously is being reused. I guess this is one of those inavoidable
>>leaks that occur when you play with fire, i.e., TerminateThread.
>
>TerminateThread and TerminateProcess are considered evil, from what I
>read.
Hence my "play with fire" comment.
>Is there any way to avoid them? For example, on a pipe read, does
>Windows have something like select() so that the reader thread can wait
>for a "terminate yourself" or a "data can be read from the pipe"
>condition?
If there was something like that, don't you think I'd be using it rather
than this kludge? I instituted this change after all of the complaints
about pipe reads being slow. This sped up reads but at the expense of
using TerminateThread, with all that entails.
cgf