[Patches] [ python-Patches-1044089 ] Bug #1011380 alternate fix -
locking is noop without threads
SourceForge.net
noreply at sourceforge.net
Sun Oct 10 19:26:21 CEST 2004
Patches item #1044089, was opened at 2004-10-10 12:59
Message generated for change (Comment added) made by tim_one
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.
----------------------------------------------------------------------
>Comment By: Tim Peters (tim_one)
Date: 2004-10-10 13:26
Message:
Logged In: YES
user_id=31435
As with the other patch, it's not acceptable to slow down
every locking function in the core. It would be fine to add
PyEval_ThreadsInitialized() to the API. Doing any more than
just that is debatable, requires doc changes, etc.
Note that most of this patch appears to consist of
whitespace changes. Those should be checked in separately.
----------------------------------------------------------------------
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