Message303291
Currently, Python exposes "thread identifiers" as unsigned long values across multiple modules:
threading.get_ident() -> Returns an integer thread id
sys._current_frames() -> Dictionary keys are integer thread ids
signal.pthread_kill() -> Accepts an arbitrary integer thread id
In reality, OS level thread identifiers are opaque types. On a system with pthreads, the thread_id that Python provides is merely pthread_t casted to unsigned long. This works today, but is in violation of the standard, and could break on systems with exotic pthread_t.
There is also the ability to introduce undefined behavior, such as sending a signal to an invalid thread id:
>>> signal.pthread_kill(42, signal.SIGHUP)
Segmentation fault (core dumped)
Changing the thread identifiers to an opaque type (which also tracks the validity of the thread id, for blocking use of expired system thread ids) will solve these two issues. |
|
Date |
User |
Action |
Args |
2017-09-29 00:39:32 | pdox | set | recipients:
+ pdox |
2017-09-29 00:39:32 | pdox | set | messageid: <1506645572.33.0.213398074469.issue31622@psf.upfronthosting.co.za> |
2017-09-29 00:39:32 | pdox | link | issue31622 messages |
2017-09-29 00:39:30 | pdox | create | |
|