classification
Title: Update thread_foobar.h to include timed locking and TLS support
Type: enhancement Stage: resolved
Components: Interpreter Core Versions: Python 3.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: Jack.McCracken, pitrou, python-dev, tim.peters
Priority: normal Keywords: patch

Created on 2014-04-19 17:30 by Jack.McCracken, last changed 2014-04-28 19:13 by pitrou. This issue is now closed.

Files
File name Uploaded Description Edit
update_thread_foobar.diff Jack.McCracken, 2014-04-19 17:30
update_thread_foobar_v2.diff Jack.McCracken, 2014-04-19 17:33 review
update_thread_foobar_v3.diff Jack.McCracken, 2014-04-19 17:45
update_thread_foobar_v4.diff Jack.McCracken, 2014-04-19 17:50
Messages (9)
msg216867 - (view) Author: Jack McCracken (Jack.McCracken) * Date: 2014-04-19 17:30
The thread_foobar.h reference for the interface for abstracting the platform-specific thread implementation does not include newer features such as timed locking and TLS support.
msg216868 - (view) Author: Jack McCracken (Jack.McCracken) * Date: 2014-04-19 17:33
Missed a word in a comment
msg216869 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2014-04-19 17:34
You may want to provide an implementation of PyThread_acquire_lock() that simply defers to PyThread_acquire_lock_timed() (see thread_pthread.h, which does the same).
msg216870 - (view) Author: Jack McCracken (Jack.McCracken) * Date: 2014-04-19 17:45
Added an example of deferring to PyThread_acquire_lock_timed in PyThread_acquire_lock. Also fixed a mistake in the string of a dprintf in PyThread_acquire_lock_timed.
msg216871 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2014-04-19 17:48
Hum, your comment about deferring is wrong, since thread_nt.h also does the deferring:

int
PyThread_acquire_lock(PyThread_type_lock aLock, int waitflag)
{
    return PyThread_acquire_lock_timed(aLock, waitflag ? -1 : 0, 0);
}
msg216872 - (view) Author: Jack McCracken (Jack.McCracken) * Date: 2014-04-19 17:50
Oops... I removed that and just put the deferral in there.
msg216873 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2014-04-19 17:55
Thanks! The patch looks good to me, I'll let it sleep a bit to see if other people have an opinion.
msg217397 - (view) Author: Roundup Robot (python-dev) Date: 2014-04-28 19:12
New changeset 7bb1bda5dcef by Antoine Pitrou in branch 'default':
Issue #21312: Update the thread_foobar.h template file to include newer threading APIs.  Patch by Jack McCracken.
http://hg.python.org/cpython/rev/7bb1bda5dcef
msg217398 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2014-04-28 19:13
Ok, noone chimed in, so I committed the patch :-)
Thank you very much for your contribution!
History
Date User Action Args
2014-04-28 19:13:13pitrousetstatus: open -> closed
resolution: fixed
messages: + msg217398

stage: patch review -> resolved
2014-04-28 19:12:37python-devsetnosy: + python-dev
messages: + msg217397
2014-04-19 17:55:00pitrousetversions: + Python 3.5
nosy: + tim.peters

messages: + msg216873

stage: patch review
2014-04-19 17:50:54Jack.McCrackensetfiles: + update_thread_foobar_v4.diff

messages: + msg216872
2014-04-19 17:48:09pitrousetmessages: + msg216871
2014-04-19 17:45:39Jack.McCrackensetfiles: + update_thread_foobar_v3.diff

messages: + msg216870
2014-04-19 17:34:43pitrousetnosy: + pitrou
messages: + msg216869
2014-04-19 17:33:38Jack.McCrackensetfiles: + update_thread_foobar_v2.diff

messages: + msg216868
2014-04-19 17:30:33Jack.McCrackencreate