Back to index

rabbitmq-server  2.8.4
Public Member Functions | Public Attributes
base.Latch Class Reference

List of all members.

Public Member Functions

def __init__
def countdown
def await
def get_count

Public Attributes

 cond
 count

Detailed Description

Definition at line 116 of file base.py.


Constructor & Destructor Documentation

def base.Latch.__init__ (   self,
  count = 1 
)

Definition at line 118 of file base.py.

00118 
00119    def __init__(self, count=1):
00120       self.cond = threading.Condition()
00121       self.cond.acquire()
00122       self.count = count
00123       self.cond.release()


Member Function Documentation

def base.Latch.await (   self,
  timeout = None 
)

Definition at line 132 of file base.py.

00132 
00133    def await(self, timeout=None):
00134       try:
00135          self.cond.acquire()
00136          if self.count == 0:
00137             return True
00138          else:
00139             self.cond.wait(timeout)
00140             return self.count == 0
00141       finally:
00142          self.cond.release()

def base.Latch.countdown (   self)

Definition at line 124 of file base.py.

00124 
00125    def countdown(self):
00126       self.cond.acquire()
00127       if self.count > 0:
00128          self.count -= 1
00129       if self.count == 0:
00130          self.cond.notify_all()
00131       self.cond.release()

def base.Latch.get_count (   self)

Definition at line 143 of file base.py.

00143 
00144    def get_count(self):
00145       try:
00146           self.cond.acquire()
00147           return self.count
00148       finally:
00149           self.cond.release()

Member Data Documentation

Definition at line 119 of file base.py.

Definition at line 121 of file base.py.


The documentation for this class was generated from the following file: