vendor/zasync/1.1

changeset 20:a6cd4a91d41e z29-nux 1.0.0-z29-nux

Queue changed with Python 2.3.4. Without backward compatibility
author janguenot
date Wed, 08 Feb 2006 13:34:15 +0000
parents a9a4db6b257b
children 08477c62127a
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!).