Merged revisions 75818 via svnmerge from

svn+ssh://pythondev@svn.python.org/python/trunk

........
  r75818 | antoine.pitrou | 2009-10-27 18:41:58 +0100 (mar., 27 oct. 2009) | 3 lines

  Issue #7205: Fix a possible deadlock when using a BZ2File object from several threads at once.
........
This commit is contained in:
Antoine Pitrou 2009-10-27 17:47:14 +00:00
parent 495f7b5adb
commit c66363f5e0
3 changed files with 27 additions and 1 deletions

View file

@ -78,7 +78,12 @@ typedef fpos_t Py_off_t;
#ifdef WITH_THREAD
#define ACQUIRE_LOCK(obj) PyThread_acquire_lock(obj->lock, 1)
#define ACQUIRE_LOCK(obj) do { \
if (!PyThread_acquire_lock(obj->lock, 0)) { \
Py_BEGIN_ALLOW_THREADS \
PyThread_acquire_lock(obj->lock, 1); \
Py_END_ALLOW_THREADS \
} } while(0)
#define RELEASE_LOCK(obj) PyThread_release_lock(obj->lock)
#else
#define ACQUIRE_LOCK(obj)