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

Method notify

Lib/multiprocessing/synchronize.py:277–301  ·  view source on GitHub ↗
(self, n=1)

Source from the content-addressed store, hash-verified

275 self._lock.acquire()
276
277 def notify(self, n=1):
278 assert self._lock._semlock._is_mine(), 'lock is not owned'
279 assert not self._wait_semaphore.acquire(
280 False), ('notify: Should not have been able to acquire '
281 + '_wait_semaphore')
282
283 # to take account of timeouts since last notify*() we subtract
284 # woken_count from sleeping_count and rezero woken_count
285 while self._woken_count.acquire(False):
286 res = self._sleeping_count.acquire(False)
287 assert res, ('notify: Bug in sleeping_count.acquire'
288 + '- res should not be False')
289
290 sleepers = 0
291 while sleepers < n and self._sleeping_count.acquire(False):
292 self._wait_semaphore.release() # wake up one sleeper
293 sleepers += 1
294
295 if sleepers:
296 for i in range(sleepers):
297 self._woken_count.acquire() # wait for a sleeper to wake
298
299 # rezero wait_semaphore in case some timeouts just happened
300 while self._wait_semaphore.acquire(False):
301 pass
302
303 def notify_all(self):
304 self.notify(n=sys.maxsize)

Callers 7

notify_allMethod · 0.95
putMethod · 0.45
_finalize_closeMethod · 0.45
putMethod · 0.45
_setMethod · 0.45
_set_lengthMethod · 0.45
_setMethod · 0.45

Calls 3

_is_mineMethod · 0.80
acquireMethod · 0.45
releaseMethod · 0.45

Tested by

no test coverage detected