[Patches] [ python-Patches-1044089 ] Bug #1011380 alternate fix - locking is noop without threads

SourceForge.net noreply at sourceforge.net
Sun Oct 10 18:59:09 CEST 2004


Patches item #1044089, was opened at 2004-10-11 02:59
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1044089&group_id=5470

Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Nick Coghlan (ncoghlan)
Assigned to: Nobody/Anonymous (nobody)
Summary: Bug #1011380 alternate fix - locking is noop without threads

Initial Comment:
Bug# 1011380 points out that locking operations such as
PyGILState_Ensure and PyGILState_Release should be
noop's if PyEval_InitThreads has not been called.

However, for reasons stated there, I dislike the
mechanism used in the patch supplied with the bug
report. The patch attached here uses a different mechanism:

 - within ceval.c, the PyEval_(Thread/Lock) functions
all use the existence of the GIL to check if
PyEval_InitThreads has been called. This matches
existing usage in ceval.c
 - a new API function PyEval_ThreadsInitialized() is
added to ceval.h that returns a true result only if the
GIL exists.
 - this new API is used by the PyGILState functions to
short-circuit their operation if the GIL does not exist.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1044089&group_id=5470


More information about the Patches mailing list