コード例 #1
0
ファイル: betterThreading.py プロジェクト: ekohl/vdsm
 def wait(self, timeout=None):
     if timeout is not None:
         bailout = time.time() + timeout
         abstime = pthread.timespec()
         abstime.tv_sec = int(bailout)
         abstime.tv_nsec = int((bailout - int(bailout)) * (10 ** 9))
         return self.__cond.timedwait(abstime)
     else:
         return self.__cond.wait()
コード例 #2
0
 def wait(self, timeout=None):
     if timeout is not None:
         bailout = time.time() + timeout
         abstime = pthread.timespec()
         abstime.tv_sec = int(bailout)
         abstime.tv_nsec = int((bailout - int(bailout)) * (10**9))
         return self.__cond.timedwait(abstime)
     else:
         return self.__cond.wait()
コード例 #3
0
ファイル: pthreading.py プロジェクト: oVirt/pthreading
 def _wait_timeout(self, timeout):
     bailout = time.time() + timeout
     abstime = pthread.timespec()
     abstime.tv_sec = int(bailout)
     abstime.tv_nsec = int((bailout - int(bailout)) * (10 ** 9))
     while True:
         if self.__cond.timedwait(abstime) == errno.ETIMEDOUT:
             break
         if self.__signals > 0:
             self.__signals -= 1
             break
コード例 #4
0
ファイル: pthreading.py プロジェクト: minqf/pthreading
 def _wait_timeout(self, timeout):
     bailout = time.time() + timeout
     abstime = pthread.timespec()
     abstime.tv_sec = int(bailout)
     abstime.tv_nsec = int((bailout - int(bailout)) * (10**9))
     while True:
         if self.__cond.timedwait(abstime) == errno.ETIMEDOUT:
             break
         if self.__signals > 0:
             self.__signals -= 1
             break
コード例 #5
0
ファイル: pthreading.py プロジェクト: ficoos/pthreading
    def wait_until(self, bailout):
        """
        Waits until bailout time has passed or the condtion is notified.

        This may return before bailout time if notify() or notify_all() were
        invoked, or because of spurious wakeup of the underlying
        implementation. You must check the return value to detect if bailout
        time has passed.

        Return True if bailout timeout has passed, False otherwise.
        """
        abstime = pthread.timespec()
        abstime.tv_sec = int(bailout)
        abstime.tv_nsec = int((bailout - int(bailout)) * (10 ** 9))
        return self.__cond.timedwait(abstime) == errno.ETIMEDOUT