vendor/zasync/1.1

changeset 50:cda47f844bfa z2.8-py2.4

backport z29-nux version
author bdelbosc
date Mon, 24 Sep 2007 14:11:25 +0000
parents 25808964cd6a
children 9eead0ceeaf7
files bucketqueue.py
diffstat 1 files changed, 6 insertions(+), 3 deletions(-) [+]
line diff
     1.1 --- a/bucketqueue.py
     1.2 +++ b/bucketqueue.py
     1.3 @@ -20,12 +20,15 @@
     1.4      unblocked buckets, order is also honored.
     1.5      """
     1.6      def __init__(self, maxsize=0):
     1.7 +        Queue.__init__(self, maxsize)
     1.8 +        self._bucketsema = {} # bucket name to bucket semaphore
     1.9 +        self._threadbucket = {} # thread id to bucket name
    1.10          # in Queue, fsema presumably stands for (not) full semaphore, and esema
    1.11          # stands for (not) empty semaphore.  For us, esema will mean "primed"
    1.12          # or "available" semaphore.
    1.13 -        Queue.__init__(self, maxsize)
    1.14 -        self._bucketsema = {} # bucket name to bucket semaphore
    1.15 -        self._threadbucket = {} # thread id to bucket name
    1.16 +        self.fsema = thread.allocate_lock()
    1.17 +        self.esema = thread.allocate_lock()
    1.18 +        self.esema.acquire()
    1.19  
    1.20      def primed(self):
    1.21          """Return True if the queue is primed, False otherwise (not reliable!).