(self, blocking=True)
| 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 |
no outgoing calls
no test coverage detected