homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Relation between threads and signals unclear
Type: Stage: resolved
Components: Documentation Versions: Python 3.3
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: docs@python Nosy List: docs@python, neologix, pitrou, python-dev, smarnach, vstinner
Priority: normal Keywords:

Created on 2012年03月30日 23:12 by smarnach, last changed 2022年04月11日 14:57 by admin. This issue is now closed.

Messages (7)
msg157156 - (view) Author: Sven Marnach (smarnach) Date: 2012年03月30日 23:12
The documentation of the 'signal' module states on the one hand
 [T]he main thread will be the only one to receive signals (this is
 enforced by the Python signal module, even if the underlying thread
 implementation supports sending signals to individual threads).
On the other hand, it provides the function 'pthread_kill()':
 Send the signal signum to the thread thread_id, another thread in
 the same process as the caller. The signal is asynchronously
 directed to thread.
These two passages are in contradiction to each other. The documentation also states that only the main thread can set signal handlers -- if this is true, it is utterly unclear how sending signals to other threads is useful.
Probably the documentation wasn't fully updated when the above function was introduced.
msg157158 - (view) Author: Sven Marnach (smarnach) Date: 2012年03月30日 23:27
For reference: the functions 'pthread_kill()' etc. were intrduced in issue8407.
msg157160 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2012年03月30日 23:41
> These two passages are in contradiction to each other.
By default, a thread signal can receive any signal and the signal handler implemented in C will be called in the context of the thread.
CPython ensures that a signal handler implemented in Python and installed by signal.signal() will be called in the main thread. It uses a signal handler implemented in C which only store the notification and will be the Python signal handler later (as early as possible).
pthread_sigmask() can be used to mask some signals (or all signals) on a specific thread.
msg157222 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2012年03月31日 19:14
New changeset 52e32f3b933d by Antoine Pitrou in branch '3.2':
Issue #14456: improve documentation of the signal module w.r.t. threads.
http://hg.python.org/cpython/rev/52e32f3b933d
New changeset 44d13f371811 by Antoine Pitrou in branch 'default':
Issue #14456: improve documentation of the signal module w.r.t. threads.
http://hg.python.org/cpython/rev/44d13f371811 
msg157223 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2012年03月31日 19:15
Should be fixed now.
msg157238 - (view) Author: Sven Marnach (smarnach) Date: 2012年03月31日 23:18
Thanks, Antoine! It's perfectly clear now, and the newly introduces headlines are a definite improvement.
msg263160 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016年04月11日 02:47
New changeset 73050563053f by Martin Panter in branch '3.5':
Issue #14456: Remove contradiction about blocking signals from bad merge
https://hg.python.org/cpython/rev/73050563053f
New changeset a8dbe6016a31 by Martin Panter in branch 'default':
Issue #14456: Merge signal doc fix from 3.5
https://hg.python.org/cpython/rev/a8dbe6016a31 
History
Date User Action Args
2022年04月11日 14:57:28adminsetgithub: 58661
2016年04月11日 02:47:20python-devsetmessages: + msg263160
2012年03月31日 23:18:54smarnachsetmessages: + msg157238
2012年03月31日 19:15:45pitrousetstatus: open -> closed

nosy: + pitrou
messages: + msg157223

resolution: fixed
stage: resolved
2012年03月31日 19:14:59python-devsetnosy: + python-dev
messages: + msg157222
2012年03月30日 23:41:19vstinnersetnosy: + vstinner, neologix
messages: + msg157160
2012年03月30日 23:27:04smarnachsetmessages: + msg157158
2012年03月30日 23:12:58smarnachcreate

AltStyle によって変換されたページ (->オリジナル) /