MCPcopy Index your code
hub / github.com/RustPython/RustPython / wait

Method wait

Lib/multiprocessing/synchronize.py:254–275  ·  view source on GitHub ↗
(self, timeout=None)

Source from the content-addressed store, hash-verified

252 return '<%s(%s, %s)>' % (self.__class__.__name__, self._lock, num_waiters)
253
254 def wait(self, timeout=None):
255 assert self._lock._semlock._is_mine(), \
256 'must acquire() condition before using wait()'
257
258 # indicate that this thread is going to sleep
259 self._sleeping_count.release()
260
261 # release lock
262 count = self._lock._semlock._count()
263 for i in range(count):
264 self._lock.release()
265
266 try:
267 # wait for notification or timeout
268 return self._wait_semaphore.acquire(True, timeout)
269 finally:
270 # indicate that this thread has woken
271 self._woken_count.release()
272
273 # reacquire lock
274 for i in range(count):
275 self._lock.acquire()
276
277 def notify(self, n=1):
278 assert self._lock._semlock._is_mine(), 'lock is not owned'

Callers 1

wait_forMethod · 0.95

Calls 4

_is_mineMethod · 0.80
releaseMethod · 0.45
_countMethod · 0.45
acquireMethod · 0.45

Tested by

no test coverage detected