MCPcopy Index your code
hub / github.com/python/cpython / Semaphore

Class Semaphore

Lib/multiprocessing/synchronize.py:132–150  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

130#
131
132class Semaphore(SemLock):
133
134 def __init__(self, value=1, *, ctx):
135 SemLock.__init__(self, SEMAPHORE, value, SEM_VALUE_MAX, ctx=ctx)
136
137 def get_value(self):
138 '''Returns current value of Semaphore.
139
140 Raises NotImplementedError on Mac OSX
141 because of broken sem_getvalue().
142 '''
143 return self._semlock._get_value()
144
145 def __repr__(self):
146 try:
147 value = self.get_value()
148 except Exception:
149 value = 'unknown'
150 return '<%s(value=%s)>' % (self.__class__.__name__, value)
151
152#
153# Bounded semaphore

Callers 1

SemaphoreMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…