mirror of https://github.com/python/cpython
Merged revisions 76007 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r76007 | antoine.pitrou | 2009-11-01 12:58:22 +0100 (dim., 01 nov. 2009) | 3 lines Buffered I/O: optimize lock taking in the common non-contended case. ........
This commit is contained in:
parent
b6b8b513c5
commit
5800b27104
|
@ -260,9 +260,11 @@ typedef struct {
|
|||
|
||||
#ifdef WITH_THREAD
|
||||
#define ENTER_BUFFERED(self) \
|
||||
Py_BEGIN_ALLOW_THREADS \
|
||||
PyThread_acquire_lock(self->lock, 1); \
|
||||
Py_END_ALLOW_THREADS
|
||||
if (!PyThread_acquire_lock(self->lock, 0)) { \
|
||||
Py_BEGIN_ALLOW_THREADS \
|
||||
PyThread_acquire_lock(self->lock, 1); \
|
||||
Py_END_ALLOW_THREADS \
|
||||
}
|
||||
|
||||
#define LEAVE_BUFFERED(self) \
|
||||
PyThread_release_lock(self->lock);
|
||||
|
|
Loading…
Reference in New Issue