Kaydet (Commit) c24ca4b1 authored tarafından Andrew M. Kuchling's avatar Andrew M. Kuchling

Fix probable bug; if errno == EINTR, floatsleep() doesn't break out of

   a Py_BEGIN_ALLOW_THREADS/Py_END_ALLOW_THREADS block, but it
   calls Py_BLOCK_THREADS anyway. The change moves Py_BLOCK_THREADS
   to inside the if, so it's only executed when the function
   actually returns unexpectedly.
üst 70b5d47f
...@@ -755,12 +755,12 @@ floatsleep(double secs) ...@@ -755,12 +755,12 @@ floatsleep(double secs)
t.tv_usec = (long)(frac*1000000.0); t.tv_usec = (long)(frac*1000000.0);
Py_BEGIN_ALLOW_THREADS Py_BEGIN_ALLOW_THREADS
if (select(0, (fd_set *)0, (fd_set *)0, (fd_set *)0, &t) != 0) { if (select(0, (fd_set *)0, (fd_set *)0, (fd_set *)0, &t) != 0) {
Py_BLOCK_THREADS
#ifdef EINTR #ifdef EINTR
if (errno != EINTR) { if (errno != EINTR) {
#else #else
if (1) { if (1) {
#endif #endif
Py_BLOCK_THREADS
PyErr_SetFromErrno(PyExc_IOError); PyErr_SetFromErrno(PyExc_IOError);
return -1; return -1;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment