[Python-checkins] r76145 - in sandbox/trunk/newgil: Include/ceval.h Modules/_io/fileio.c Modules/_multiprocessing/connection.h Modules/_multiprocessing/pipe_connection.c Modules/_multiprocessing/socket_connection.c Modules/_ssl.c Modules/bz2module.c Modules/posixmodule.c Modules/selectmodule.c Modules/socketmodule.c Python/ceval.c Python/ceval_gil.h
antoine.pitrou
python-checkins at python.org
Sat Nov 7 21:35:04 CET 2009
Author: antoine.pitrou
Date: Sat Nov 7 21:35:04 2009
New Revision: 76145
Log:
Remove priority requests altogether.
Modified:
sandbox/trunk/newgil/Include/ceval.h
sandbox/trunk/newgil/Modules/_io/fileio.c
sandbox/trunk/newgil/Modules/_multiprocessing/connection.h
sandbox/trunk/newgil/Modules/_multiprocessing/pipe_connection.c
sandbox/trunk/newgil/Modules/_multiprocessing/socket_connection.c
sandbox/trunk/newgil/Modules/_ssl.c
sandbox/trunk/newgil/Modules/bz2module.c
sandbox/trunk/newgil/Modules/posixmodule.c
sandbox/trunk/newgil/Modules/selectmodule.c
sandbox/trunk/newgil/Modules/socketmodule.c
sandbox/trunk/newgil/Python/ceval.c
sandbox/trunk/newgil/Python/ceval_gil.h
Modified: sandbox/trunk/newgil/Include/ceval.h
==============================================================================
--- sandbox/trunk/newgil/Include/ceval.h (original)
+++ sandbox/trunk/newgil/Include/ceval.h Sat Nov 7 21:35:04 2009
@@ -159,7 +159,6 @@
PyAPI_FUNC(PyThreadState *) PyEval_SaveThread(void);
PyAPI_FUNC(void) PyEval_RestoreThread(PyThreadState *);
-PyAPI_FUNC(void) PyEval_RestoreThreadPrio(PyThreadState *, int prio);
#ifdef WITH_THREAD
@@ -181,8 +180,6 @@
#define Py_UNBLOCK_THREADS _save = PyEval_SaveThread();
#define Py_END_ALLOW_THREADS PyEval_RestoreThread(_save); \
}
-#define Py_END_ALLOW_THREADS_PRIO(x) PyEval_RestoreThreadPrio(_save, (x)); \
- }
#else /* !WITH_THREAD */
Modified: sandbox/trunk/newgil/Modules/_io/fileio.c
==============================================================================
--- sandbox/trunk/newgil/Modules/_io/fileio.c (original)
+++ sandbox/trunk/newgil/Modules/_io/fileio.c Sat Nov 7 21:35:04 2009
@@ -476,7 +476,7 @@
Py_BEGIN_ALLOW_THREADS
errno = 0;
n = read(self->fd, pbuf.buf, pbuf.len);
- Py_END_ALLOW_THREADS_PRIO(n > 0)
+ Py_END_ALLOW_THREADS
} else
n = -1;
PyBuffer_Release(&pbuf);
@@ -559,7 +559,7 @@
n = read(self->fd,
PyBytes_AS_STRING(result) + total,
newsize - total);
- Py_END_ALLOW_THREADS_PRIO(n > 0)
+ Py_END_ALLOW_THREADS
if (n == 0)
break;
if (n < 0) {
@@ -615,7 +615,7 @@
Py_BEGIN_ALLOW_THREADS
errno = 0;
n = read(self->fd, ptr, size);
- Py_END_ALLOW_THREADS_PRIO(n > 0)
+ Py_END_ALLOW_THREADS
} else
n = -1;
Modified: sandbox/trunk/newgil/Modules/_multiprocessing/connection.h
==============================================================================
--- sandbox/trunk/newgil/Modules/_multiprocessing/connection.h (original)
+++ sandbox/trunk/newgil/Modules/_multiprocessing/connection.h Sat Nov 7 21:35:04 2009
@@ -367,7 +367,7 @@
Py_BEGIN_ALLOW_THREADS
res = conn_poll(self, timeout, _save);
- Py_END_ALLOW_THREADS_PRIO(res == TRUE)
+ Py_END_ALLOW_THREADS
switch (res) {
case TRUE:
Modified: sandbox/trunk/newgil/Modules/_multiprocessing/pipe_connection.c
==============================================================================
--- sandbox/trunk/newgil/Modules/_multiprocessing/pipe_connection.c (original)
+++ sandbox/trunk/newgil/Modules/_multiprocessing/pipe_connection.c Sat Nov 7 21:35:04 2009
@@ -49,7 +49,7 @@
Py_BEGIN_ALLOW_THREADS
ret = ReadFile(conn->handle, buffer, MIN(buflength, maxlength),
&length, NULL);
- Py_END_ALLOW_THREADS_PRIO(ret)
+ Py_END_ALLOW_THREADS
if (ret)
return length;
@@ -75,7 +75,7 @@
Py_BEGIN_ALLOW_THREADS
ret = ReadFile(conn->handle, *newbuffer+length, left, &length, NULL);
- Py_END_ALLOW_THREADS_PRIO(ret)
+ Py_END_ALLOW_THREADS
if (ret) {
assert(length == left);
return full_length;
Modified: sandbox/trunk/newgil/Modules/_multiprocessing/socket_connection.c
==============================================================================
--- sandbox/trunk/newgil/Modules/_multiprocessing/socket_connection.c (original)
+++ sandbox/trunk/newgil/Modules/_multiprocessing/socket_connection.c Sat Nov 7 21:35:04 2009
@@ -124,7 +124,7 @@
Py_BEGIN_ALLOW_THREADS
res = _conn_recvall(conn->handle, (char*)&ulength, 4);
- Py_END_ALLOW_THREADS_PRIO(res == MP_SUCCESS)
+ Py_END_ALLOW_THREADS
if (res < 0)
return res;
@@ -135,7 +135,7 @@
if (ulength <= buflength) {
Py_BEGIN_ALLOW_THREADS
res = _conn_recvall(conn->handle, buffer, (size_t)ulength);
- Py_END_ALLOW_THREADS_PRIO(res == MP_SUCCESS)
+ Py_END_ALLOW_THREADS
return res < 0 ? res : ulength;
} else {
*newbuffer = PyMem_Malloc((size_t)ulength);
@@ -143,7 +143,7 @@
return MP_MEMORY_ERROR;
Py_BEGIN_ALLOW_THREADS
res = _conn_recvall(conn->handle, *newbuffer, (size_t)ulength);
- Py_END_ALLOW_THREADS_PRIO(res == MP_SUCCESS)
+ Py_END_ALLOW_THREADS
return res < 0 ? (Py_ssize_t)res : (Py_ssize_t)ulength;
}
}
Modified: sandbox/trunk/newgil/Modules/_ssl.c
==============================================================================
--- sandbox/trunk/newgil/Modules/_ssl.c (original)
+++ sandbox/trunk/newgil/Modules/_ssl.c Sat Nov 7 21:35:04 2009
@@ -24,9 +24,6 @@
#define PySSL_UNBLOCK_THREADS if (_ssl_locks_count>0){_save = PyEval_SaveThread()};
#define PySSL_END_ALLOW_THREADS if (_ssl_locks_count>0){PyEval_RestoreThread(_save);} \
}
-#define PySSL_END_ALLOW_THREADS_PRIO(x) \
- if (_ssl_locks_count>0){PyEval_RestoreThreadPrio(_save, (x));} \
- }
#else /* no WITH_THREAD */
@@ -34,7 +31,6 @@
#define PySSL_BLOCK_THREADS
#define PySSL_UNBLOCK_THREADS
#define PySSL_END_ALLOW_THREADS
-#define PySSL_END_ALLOW_THREADS_PRIO(x)
#endif
@@ -1114,7 +1110,7 @@
timeout = (int)(s->sock_timeout * 1000 + 0.5);
PySSL_BEGIN_ALLOW_THREADS
rc = poll(&pollfd, 1, timeout);
- PySSL_END_ALLOW_THREADS_PRIO(rc > 0)
+ PySSL_END_ALLOW_THREADS
goto normal_return;
}
@@ -1138,7 +1134,7 @@
rc = select(s->sock_fd+1, NULL, &fds, NULL, &tv);
else
rc = select(s->sock_fd+1, &fds, NULL, NULL, &tv);
- PySSL_END_ALLOW_THREADS_PRIO(rc > 0)
+ PySSL_END_ALLOW_THREADS
#ifdef HAVE_POLL
normal_return:
@@ -1298,7 +1294,7 @@
/* first check if there are bytes ready to be read */
PySSL_BEGIN_ALLOW_THREADS
count = SSL_pending(self->ssl);
- PySSL_END_ALLOW_THREADS_PRIO(count > 0)
+ PySSL_END_ALLOW_THREADS
if (!count) {
sockstate = check_socket_and_wait_for_timeout(sock, 0);
@@ -1320,7 +1316,7 @@
PySSL_BEGIN_ALLOW_THREADS
count = SSL_read(self->ssl, mem, len);
err = SSL_get_error(self->ssl, count);
- PySSL_END_ALLOW_THREADS_PRIO(count > 0)
+ PySSL_END_ALLOW_THREADS
if (PyErr_CheckSignals())
goto error;
if (err == SSL_ERROR_WANT_READ) {
Modified: sandbox/trunk/newgil/Modules/bz2module.c
==============================================================================
--- sandbox/trunk/newgil/Modules/bz2module.c (original)
+++ sandbox/trunk/newgil/Modules/bz2module.c Sat Nov 7 21:35:04 2009
@@ -253,8 +253,7 @@
break;
*buf++ = c;
} while (bzerror == BZ_OK && c != '\n' && buf != end);
- Py_END_ALLOW_THREADS_PRIO(bzerror == BZ_STREAM_END ||
- bzerror == BZ_OK)
+ Py_END_ALLOW_THREADS
if (bzerror == BZ_STREAM_END) {
f->size = f->pos;
f->mode = MODE_READ_EOF;
@@ -328,8 +327,7 @@
}
Py_BEGIN_ALLOW_THREADS
chunksize = BZ2_bzRead(&bzerror, f->fp, f->f_buf, bufsize);
- Py_END_ALLOW_THREADS_PRIO(bzerror == BZ_STREAM_END ||
- bzerror == BZ_OK)
+ Py_END_ALLOW_THREADS
f->pos += chunksize;
if (bzerror == BZ_STREAM_END) {
f->size = f->pos;
@@ -450,8 +448,7 @@
BUF(ret)+bytesread,
buffersize-bytesread);
self->pos += chunksize;
- Py_END_ALLOW_THREADS_PRIO(bzerror == BZ_STREAM_END ||
- bzerror == BZ_OK)
+ Py_END_ALLOW_THREADS
bytesread += chunksize;
if (bzerror == BZ_STREAM_END) {
self->size = self->pos;
@@ -584,8 +581,7 @@
nread = BZ2_bzRead(&bzerror, self->fp,
buffer+nfilled, buffersize-nfilled);
self->pos += nread;
- Py_END_ALLOW_THREADS_PRIO(bzerror == BZ_STREAM_END ||
- bzerror == BZ_OK)
+ Py_END_ALLOW_THREADS
if (bzerror == BZ_STREAM_END) {
self->size = self->pos;
self->mode = MODE_READ_EOF;
@@ -942,9 +938,7 @@
chunksize = BZ2_bzRead(&bzerror, self->fp,
buffer, buffersize);
self->pos += chunksize;
- Py_END_ALLOW_THREADS_PRIO(
- bzerror == BZ_STREAM_END ||
- bzerror == BZ_OK)
+ Py_END_ALLOW_THREADS
bytesread += chunksize;
if (bzerror == BZ_STREAM_END) {
@@ -1003,8 +997,7 @@
Py_BEGIN_ALLOW_THREADS
chunksize = BZ2_bzRead(&bzerror, self->fp, buffer, readsize);
self->pos += chunksize;
- Py_END_ALLOW_THREADS_PRIO(bzerror == BZ_STREAM_END ||
- bzerror == BZ_OK)
+ Py_END_ALLOW_THREADS
bytesread += chunksize;
if (bzerror == BZ_STREAM_END) {
self->size = self->pos;
Modified: sandbox/trunk/newgil/Modules/posixmodule.c
==============================================================================
--- sandbox/trunk/newgil/Modules/posixmodule.c (original)
+++ sandbox/trunk/newgil/Modules/posixmodule.c Sat Nov 7 21:35:04 2009
@@ -2197,7 +2197,7 @@
}
Py_BEGIN_ALLOW_THREADS
result = FindNextFileW(hFindFile, &wFileData);
- Py_END_ALLOW_THREADS_PRIO(result)
+ Py_END_ALLOW_THREADS
/* FindNextFile sets error to ERROR_NO_MORE_FILES if
it got to the end of the directory. */
if (!result && GetLastError() != ERROR_NO_MORE_FILES) {
@@ -2270,7 +2270,7 @@
}
Py_BEGIN_ALLOW_THREADS
result = FindNextFile(hFindFile, &FileData);
- Py_END_ALLOW_THREADS_PRIO(result)
+ Py_END_ALLOW_THREADS
/* FindNextFile sets error to ERROR_NO_MORE_FILES if
it got to the end of the directory. */
if (!result && GetLastError() != ERROR_NO_MORE_FILES) {
@@ -2395,7 +2395,7 @@
errno = 0;
Py_BEGIN_ALLOW_THREADS
ep = readdir(dirp);
- Py_END_ALLOW_THREADS_PRIO(ep || !errno)
+ Py_END_ALLOW_THREADS
if (ep == NULL) {
if (errno == 0) {
break;
@@ -4461,7 +4461,7 @@
Py_BEGIN_ALLOW_THREADS
pid = wait3(&status, options, &ru);
- Py_END_ALLOW_THREADS_PRIO(pid > 0)
+ Py_END_ALLOW_THREADS
return wait_helper(pid, WAIT_STATUS_INT(status), &ru);
}
@@ -4486,7 +4486,7 @@
Py_BEGIN_ALLOW_THREADS
pid = wait4(pid, &status, options, &ru);
- Py_END_ALLOW_THREADS_PRIO(pid > 0)
+ Py_END_ALLOW_THREADS
return wait_helper(pid, WAIT_STATUS_INT(status), &ru);
}
@@ -4509,7 +4509,7 @@
return NULL;
Py_BEGIN_ALLOW_THREADS
pid = waitpid(pid, &status, options);
- Py_END_ALLOW_THREADS_PRIO(pid > 0)
+ Py_END_ALLOW_THREADS
if (pid == -1)
return posix_error();
@@ -4533,7 +4533,7 @@
return NULL;
Py_BEGIN_ALLOW_THREADS
pid = _cwait(&status, pid, options);
- Py_END_ALLOW_THREADS_PRIO(pid > 0)
+ Py_END_ALLOW_THREADS
if (pid == -1)
return posix_error();
@@ -4556,7 +4556,7 @@
Py_BEGIN_ALLOW_THREADS
pid = wait(&status);
- Py_END_ALLOW_THREADS_PRIO(pid > 0)
+ Py_END_ALLOW_THREADS
if (pid == -1)
return posix_error();
@@ -5037,7 +5037,7 @@
return posix_error();
Py_BEGIN_ALLOW_THREADS
n = read(fd, PyBytes_AS_STRING(buffer), size);
- Py_END_ALLOW_THREADS_PRIO(n > 0)
+ Py_END_ALLOW_THREADS
if (n < 0) {
Py_DECREF(buffer);
return posix_error();
Modified: sandbox/trunk/newgil/Modules/selectmodule.c
==============================================================================
--- sandbox/trunk/newgil/Modules/selectmodule.c (original)
+++ sandbox/trunk/newgil/Modules/selectmodule.c Sat Nov 7 21:35:04 2009
@@ -273,7 +273,7 @@
Py_BEGIN_ALLOW_THREADS
n = select(max, &ifdset, &ofdset, &efdset, tvp);
- Py_END_ALLOW_THREADS_PRIO(n > 0)
+ Py_END_ALLOW_THREADS
#ifdef MS_WINDOWS
if (n == SOCKET_ERROR) {
@@ -532,7 +532,7 @@
/* call poll() */
Py_BEGIN_ALLOW_THREADS
poll_result = poll(self->ufds, self->ufd_len, timeout);
- Py_END_ALLOW_THREADS_PRIO(poll_result > 0)
+ Py_END_ALLOW_THREADS
if (poll_result < 0) {
PyErr_SetFromErrno(SelectError);
@@ -1023,7 +1023,7 @@
Py_BEGIN_ALLOW_THREADS
nfds = epoll_wait(self->epfd, evs, maxevents, timeout);
- Py_END_ALLOW_THREADS_PRIO(nfds > 0)
+ Py_END_ALLOW_THREADS
if (nfds < 0) {
PyErr_SetFromErrno(PyExc_IOError);
goto error;
@@ -1608,7 +1608,7 @@
Py_BEGIN_ALLOW_THREADS
gotevents = kevent(self->kqfd, chl, nchanges,
evl, nevents, ptimeoutspec);
- Py_END_ALLOW_THREADS_PRIO(gotevents > 0)
+ Py_END_ALLOW_THREADS
if (gotevents == -1) {
PyErr_SetFromErrno(PyExc_OSError);
Modified: sandbox/trunk/newgil/Modules/socketmodule.c
==============================================================================
--- sandbox/trunk/newgil/Modules/socketmodule.c (original)
+++ sandbox/trunk/newgil/Modules/socketmodule.c Sat Nov 7 21:35:04 2009
@@ -1591,7 +1591,7 @@
timeout = internal_select(s, 0);
if (!timeout)
newfd = accept(s->sock_fd, SAS2SA(&addrbuf), &addrlen);
- Py_END_ALLOW_THREADS_PRIO(!timeout)
+ Py_END_ALLOW_THREADS
if (timeout == 1) {
PyErr_SetString(socket_timeout, "timed out");
@@ -1967,7 +1967,7 @@
Py_BEGIN_ALLOW_THREADS
res = internal_connect(s, SAS2SA(&addrbuf), addrlen, &timeout);
- Py_END_ALLOW_THREADS_PRIO(res == 0)
+ Py_END_ALLOW_THREADS
if (timeout == 1) {
PyErr_SetString(socket_timeout, "timed out");
@@ -2001,7 +2001,7 @@
Py_BEGIN_ALLOW_THREADS
res = internal_connect(s, SAS2SA(&addrbuf), addrlen, &timeout);
- Py_END_ALLOW_THREADS_PRIO(res == 0)
+ Py_END_ALLOW_THREADS
/* Signals are not errors (though they may raise exceptions). Adapted
from PyErr_SetFromErrnoWithFilenameObject(). */
@@ -2155,7 +2155,7 @@
timeout = internal_select(s, 0);
if (!timeout)
outlen = recv(s->sock_fd, cbuf, len, flags);
- Py_END_ALLOW_THREADS_PRIO(outlen > 0)
+ Py_END_ALLOW_THREADS
if (timeout == 1) {
PyErr_SetString(socket_timeout, "timed out");
@@ -2186,7 +2186,7 @@
timeout = internal_select(s, 0);
if (!timeout)
nread = recv(s->sock_fd, read_buf, segment, flags);
- Py_END_ALLOW_THREADS_PRIO(nread > 0)
+ Py_END_ALLOW_THREADS
if (timeout == 1) {
PyErr_SetString(socket_timeout, "timed out");
@@ -2370,7 +2370,7 @@
SAS2SA(&addrbuf), &addrlen);
#endif
}
- Py_END_ALLOW_THREADS_PRIO(n > 0)
+ Py_END_ALLOW_THREADS
if (timeout == 1) {
PyErr_SetString(socket_timeout, "timed out");
Modified: sandbox/trunk/newgil/Python/ceval.c
==============================================================================
--- sandbox/trunk/newgil/Python/ceval.c (original)
+++ sandbox/trunk/newgil/Python/ceval.c Sat Nov 7 21:35:04 2009
@@ -392,29 +392,20 @@
}
void
-PyEval_RestoreThreadPrio(PyThreadState *tstate, int prio)
+PyEval_RestoreThread(PyThreadState *tstate)
{
if (tstate == NULL)
Py_FatalError("PyEval_RestoreThread: NULL tstate");
#ifdef WITH_THREAD
if (gil_created()) {
int err = errno;
- if (prio)
- take_gil_prio(tstate);
- else
- take_gil(tstate);
+ take_gil(tstate);
errno = err;
}
#endif
PyThreadState_Swap(tstate);
}
-void
-PyEval_RestoreThread(PyThreadState *tstate)
-{
- PyEval_RestoreThreadPrio(tstate, 0);
-}
-
/* Mechanism whereby asynchronously executing callbacks (e.g. UNIX
signal handlers or Mac I/O completion routines) can schedule calls
Modified: sandbox/trunk/newgil/Python/ceval_gil.h
==============================================================================
--- sandbox/trunk/newgil/Python/ceval_gil.h (original)
+++ sandbox/trunk/newgil/Python/ceval_gil.h Sat Nov 7 21:35:04 2009
@@ -17,13 +17,6 @@
#undef FORCE_SWITCHING
#define FORCE_SWITCHING
-/* Enable priority requests */
-#undef PRIO_REQUESTS
-/* #define PRIO_REQUESTS */
-
-#undef TRACE_PRIO
-/* #define TRACE_PRIO */
-
/*
Notes about the implementation:
@@ -53,10 +46,6 @@
by waiting on a variable (gil_last_holder) controlled through another
{mutex, condition} pair.
- - An optional policy mechanism, priority requests, is currently disabled.
- The intent was to further improve the latency of some types of GIL-taking
- activities, such as being woken up on a socket. If it is confirmed that
- this feature is unnecessary, support code should be removed.
*/
#ifndef _POSIX_THREADS
@@ -217,21 +206,6 @@
static MUTEX_T switch_mutex;
#endif
-/* This mutex is taken when a priority request is made, and released when
- it is finally honoured.
- Other threads can sleep by trying to lock the mutex. */
-static MUTEX_T prio_mutex;
-/* The thread making the prio request, or NULL. */
-static volatile PyThreadState *prio_request = NULL;
-
-#define YIELD_IF_PRIO_REQUEST() \
-do { \
- if (prio_request) { \
- MUTEX_LOCK(prio_mutex); \
- MUTEX_UNLOCK(prio_mutex); \
- } \
-} while (0)
-
static int gil_created(void)
{
@@ -241,9 +215,6 @@
static void create_gil(void)
{
MUTEX_INIT(gil_mutex);
-#ifdef PRIO_REQUESTS
- MUTEX_INIT(prio_mutex);
-#endif
#ifdef FORCE_SWITCHING
MUTEX_INIT(switch_mutex);
#endif
@@ -253,7 +224,6 @@
#endif
gil_locked = 0;
gil_last_holder = NULL;
- prio_request = NULL;
}
static void recreate_gil(void)
@@ -288,59 +258,23 @@
#endif
}
-static void _take_gil(PyThreadState *tstate, int prio)
+static void take_gil(PyThreadState *tstate)
{
int err;
if (tstate == NULL)
Py_FatalError("take_gil: NULL tstate");
- /* If another thread is requesting priority, give it a chance to run
- before we take the mutex.
- */
-#ifdef PRIO_REQUESTS
- YIELD_IF_PRIO_REQUEST();
-#endif
-
err = errno;
MUTEX_LOCK(gil_mutex);
- if (!gil_locked) {
- prio = 0;
+ if (!gil_locked)
goto _ready;
- }
COND_PREPARE(gil_cond);
-
- if (prio) {
-#ifdef TRACE_PRIO
- struct timeval tv;
- GETTIMEOFDAY(&tv);
- printf("trying to take gil with prio: %.3f <--\n",
- tv.tv_sec + tv.tv_usec / 1000000.0);
-#endif
- if (!prio_request) {
- MUTEX_LOCK(prio_mutex);
- prio_request = tstate;
- }
- else
- prio = 0;
- }
while (gil_locked) {
int timed_out = 0;
unsigned long saved_switchnum;
- if (prio_request) {
- /* Tell the eval loop the GIL must be dropped as soon as possible */
- SET_GIL_DROP_REQUEST();
- if (!prio) {
- /* If another thread is making the prio_request, give it a
- chance to run and take the mutex. */
- MUTEX_UNLOCK(gil_mutex);
- YIELD_IF_PRIO_REQUEST();
- MUTEX_LOCK(gil_mutex);
- }
- }
-
saved_switchnum = gil_switch_number;
COND_TIMED_WAIT(gil_cond, gil_mutex, INTERVAL, timed_out);
/* If we timed out and no switch occurred in the meantime, it is time
@@ -360,26 +294,12 @@
if (tstate != gil_last_holder) {
gil_last_holder = tstate;
++gil_switch_number;
-#ifdef TRACE_PRIO
- if (prio) {
- struct timeval tv;
- GETTIMEOFDAY(&tv);
- printf("gil taken with prio: %.3f\n",
- tv.tv_sec + tv.tv_usec / 1000000.0);
- }
-#endif
}
#ifdef FORCE_SWITCHING
COND_SIGNAL(switch_cond);
MUTEX_UNLOCK(switch_mutex);
#endif
- if (prio) {
- /* The prio request was granted. */
- prio_request = NULL;
- MUTEX_UNLOCK(prio_mutex);
- }
- if (gil_drop_request && !prio_request) {
- /* No prio_request pending. */
+ if (gil_drop_request) {
RESET_GIL_DROP_REQUEST();
}
if (tstate->async_exc != NULL) {
@@ -390,20 +310,6 @@
errno = err;
}
-static void take_gil(PyThreadState *tstate)
-{
- _take_gil(tstate, 0);
-}
-
-static void take_gil_prio(PyThreadState *tstate)
-{
-#ifdef PRIO_REQUESTS
- _take_gil(tstate, 1);
-#else
- _take_gil(tstate, 0);
-#endif
-}
-
void _PyEval_SetSwitchInterval(unsigned long microseconds)
{
gil_interval = microseconds;
More information about the Python-checkins
mailing list