This is the mail archive of the cygwin-patches mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Overflow cygthreads (those which use simplestub) don't set notify_detached event which may cause timer_delete to hung


Hi,

I think that this is a problem in cygthreads, but since I have been
looking at cygwin for less than two weeks I might as well be quite
mistaken.

The problem can be reproduced with Cygwin 1.7.9-1 and also with
today's checkout of the code.

To repro run this program form the attachment (compiled using: g++ main.cc)

One should observe the program hanging when deleting timer. On my
computer it usually is timer 31, but depending on race conditions you
might get a different one. If you don't get the problem then try
increasing TIMERS.

After spending long hours looking at cygwinthread.cc code I have come
up with the following patch to fix the problem. I believe that the
solution should be bullet-proof also if someone terminates the thread
(thread_terminate()) or calls detach(), but since it was the first
time I looked at the cygwin code I might as well be wrong.


* cygthread.cc (cygthread::simplestub): Notify that the thread has
detached also in freerange thread case.


Any comments are most welcome,

Best wishes,
Rafal
P.S. Please note that another (completely separate) problem with
freerange threads leaking memory in auto_release case exists. I will
create another post with info about that.

Attachment: patch.txt
Description: Text document

Attachment: main.cc
Description: Binary data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]