MCPcopy Create free account
hub / github.com/brmmm3/fastthreadpool / acquire

Method acquire

fastthreadpool/fastthreadpool.py:102–119  ·  view source on GitHub ↗
(self, blocking=True)

Source from the content-addressed store, hash-verified

100
101 #c cpdef bint acquire(self, bint blocking=True):
102 def acquire(self, blocking=True): #p
103 #c cdef int wait
104 if self._value >= 0:
105 self._value -= 1
106 if self._value >= 0:
107 return False
108 #c with nogil:
109 if True: #p
110 #c wait = pythread.WAIT_LOCK if blocking else pythread.NOWAIT_LOCK
111 wait = blocking #p
112 while True:
113 #c if pythread.PyThread_acquire_lock(self._lock, wait):
114 if self._lock.acquire(wait): #p
115 break
116 #c if wait == pythread.NOWAIT_LOCK:
117 if not wait: #p
118 return False
119 return True
120
121 #c cpdef void release(self):
122 def release(self): #p

Callers 13

threading_SemaphoreMethod · 0.95
__init__Method · 0.80
_busy_lock_incMethod · 0.80
_busy_lock_decMethod · 0.80
_done_threadMethod · 0.80
_done_cnt_incMethod · 0.80
_failed_threadMethod · 0.80
_childMethod · 0.80
as_completedMethod · 0.80
ex_semaphore.pyFile · 0.80
WorkerFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected