示例#1
0
 def __init__(self):
     self.selectables = set()
     self.reading = set()
     self.writing = set()
     self.waiter = selectable_waiter()
     self.reading.add(self.waiter)
     self.stopped = False
     self.thread = None
示例#2
0
 def __init__(self):
   self.selectables = set()
   self.reading = set()
   self.writing = set()
   self.waiter = selectable_waiter()
   self.reading.add(self.waiter)
   self.stopped = False
   self.thread = None
示例#3
0
 def wait(self, timeout=None):
     assert self.lock._is_owned()
     if not self.waiters:
         self.waiters.append(compat.selectable_waiter())
     sw = self.waiters.pop(0)
     self.waiting.append(sw)
     try:
         st = self.lock._release_save()
         sw.wait(timeout)
     finally:
         self.lock._acquire_restore(st)
         self.waiting.remove(sw)
         self.waiters.append(sw)
示例#4
0
 def wait(self, timeout=None):
   assert self.lock._is_owned()
   if not self.waiters:
     self.waiters.append(compat.selectable_waiter())
   sw = self.waiters.pop(0)
   self.waiting.append(sw)
   try:
     st = self.lock._release_save()
     sw.wait(timeout)
   finally:
     self.lock._acquire_restore(st)
     self.waiting.remove(sw)
     self.waiters.append(sw)