Mercurial > cpython-lru_cache-weakref
diff Modules/_threadmodule.c @ 68273:6ba9ba58499e
Issue #11408: In threading.Lock.acquire(), only call gettimeofday() when
really necessary. Patch by Charles-François Natali.
| author | Antoine Pitrou <solipsis@pitrou.net> |
|---|---|
| date | Sun, 06 Mar 2011 08:40:35 +0100 |
| parents | b39270c6b8d1 |
| children | 4c1a15ebebe5 |
line wrap: on
line diff
--- a/Modules/_threadmodule.c Sun Mar 06 01:53:19 2011 +0100 +++ b/Modules/_threadmodule.c Sun Mar 06 08:40:35 2011 +0100 @@ -54,8 +54,8 @@ _PyTime_timeval endtime; - _PyTime_gettimeofday(&endtime); if (microseconds > 0) { + _PyTime_gettimeofday(&endtime); endtime.tv_sec += microseconds / (1000 * 1000); endtime.tv_usec += microseconds % (1000 * 1000); } @@ -76,7 +76,7 @@ /* If we're using a timeout, recompute the timeout after processing * signals, since those can take time. */ - if (microseconds >= 0) { + if (microseconds > 0) { _PyTime_gettimeofday(&curtime); microseconds = ((endtime.tv_sec - curtime.tv_sec) * 1000000 + (endtime.tv_usec - curtime.tv_usec));
