Message121863
| Author |
nh2 |
| Recipients |
BreamoreBoy, Rhamphoryncus, bamby, exarkun, georg.brandl, laca, movement, mstepnicki, nh2, pitrou, ross |
| Date |
2010年11月21日.04:32:44 |
| SpamBayes Score |
0.0007370764 |
| Marked as misclassified |
No |
| Message-id |
<1290313965.83.0.889733901892.issue1975@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
I think this is still an issue.
If I register signal.signal(signal.SIGINT, handler) in the main thread, I get a race between
- only the main thread receives the signal (everything is fine)
- both the main thread and currently running threads receive the signal => the handler is called multiple times => all kinds of resource-problems like "close failed in file object destructor: IOError: [Errno 9] Bad file descriptor" in thread cleanup functions
Note that I cannot even declare a sigintlock = threading.Lock() and use with sigintlock in the handler - if I print threading.current_thread() and sys.exit() directly afterwards in the locked area, I sometimes get two print outputs which show MainThread and Thread-1 being inside the locked area at the same time!
Is the synchronization broken or am I doing something wrong?
Is synchronization over handlers really the way to cope with this? Disabling signals for non-main threads currently seems more sensible to me.
Can someone please verify the race I get? |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2010年11月21日 04:32:45 | nh2 | set | recipients:
+ nh2, georg.brandl, exarkun, Rhamphoryncus, pitrou, movement, ross, bamby, laca, mstepnicki, BreamoreBoy |
| 2010年11月21日 04:32:45 | nh2 | set | messageid: <1290313965.83.0.889733901892.issue1975@psf.upfronthosting.co.za> |
| 2010年11月21日 04:32:44 | nh2 | link | issue1975 messages |
| 2010年11月21日 04:32:44 | nh2 | create |
|