コード例 #1
0
    def test_semaphore_rebuild(self):
        from _multiprocessing import SemLock
        kind = self.SEMAPHORE
        value = 1
        maxvalue = 1
        sem = SemLock(kind, value, maxvalue)

        sem2 = SemLock._rebuild(sem.handle, kind, value)
        assert sem.handle == sem2.handle
コード例 #2
0
ファイル: test_semaphore.py プロジェクト: Debug-Orz/Sypy
    def test_semaphore_rebuild(self):
        from _multiprocessing import SemLock
        kind = self.SEMAPHORE
        value = 1
        maxvalue = 1
        sem = SemLock(kind, value, maxvalue)

        sem2 = SemLock._rebuild(sem.handle, kind, value)
        assert sem.handle == sem2.handle
コード例 #3
0
 def __setstate__(self, state):
     if sys.version_info < (3, 4):
         h, kind, maxvalue, name = state
         self._semlock = SemLockC(h, kind, maxvalue, name=name)
     else:
         self._semlock = SemLockC._rebuild(*state)
     util.debug('recreated blocker with handle %r and name %s' %
                (state[0], state[3]))
     self._make_methods()
コード例 #4
0
 def test_semaphore_rebuild(self):
     import sys
     if sys.platform == 'win32':
         from _multiprocessing import SemLock
         def sem_unlink(*args):
             pass
     else:
         from _multiprocessing import SemLock, sem_unlink
     kind = self.SEMAPHORE
     value = 1
     maxvalue = 1
     sem = SemLock(kind, value, maxvalue, "4.2", unlink=False)
     try:
         sem2 = SemLock._rebuild(-1, kind, value, "4.2")
         #assert sem.handle != sem2.handle---even though they come
         # from different calls to sem_open(), on Linux at least,
         # they are the same pointer
         sem2 = SemLock._rebuild(sem.handle, kind, value, None)
         assert sem.handle == sem2.handle
     finally:
         sem_unlink("4.2")
コード例 #5
0
 def __setstate__(self, state):
     self._semlock = _SemLock._rebuild(*state)
     util.debug('recreated blocker with handle %r and name "%s"'
                % (state[0], state[3]))
     self._make_methods()
コード例 #6
0
ファイル: synchronize.py プロジェクト: pombredanne/loky
 def __setstate__(self, state):
     self._semlock = _SemLock._rebuild(*state)
     util.debug(
         f'recreated blocker with handle {state[0]!r} and name "{state[3]}"'
     )
     self._make_methods()
コード例 #7
0
ファイル: synchronize.py プロジェクト: ELVIS-Project/music21
 def __setstate__(self, state):
     self._semlock = _SemLock._rebuild(*state)
     util.debug('recreated blocker with handle %r and name "%s"'
                % (state[0], state[3]))
     self._make_methods()
コード例 #8
0
ファイル: shmem_sync.py プロジェクト: sdiehl/numpush
 def __setstate__(self, state):
     reader, writer = state
     self._reader = SemLock._rebuild(*reader)
     self._writer = SemLock._rebuild(*writer)