MCPcopy Create free account
hub / github.com/ActiveState/code / sync

Method sync

recipes/Python/496865_zsyncpy/recipe-496865.py:24–37  ·  view source on GitHub ↗

Automatically syncronizes threads.

(self)

Source from the content-addressed store, hash-verified

22 self.__exit.acquire()
23
24 def sync(self):
25 'Automatically syncronizes threads.'
26 self.__main.acquire()
27 self.__count += 1
28 if self.__count < self.__threads:
29 self.__main.release()
30 else:
31 self.__exit.release()
32 self.__exit.acquire()
33 self.__count -= 1
34 if self.__count > 0:
35 self.__exit.release()
36 else:
37 self.__main.release()
38
39################################################################################
40

Callers 2

clientMethod · 0.95
processorMethod · 0.45

Calls 2

acquireMethod · 0.45
releaseMethod · 0.45

Tested by

no test coverage detected