[PATCH v2] Re: refactoring: simplify the semaphorewait logic

Nicolas Sebrecht nicolas.s-dev at laposte.net
Thu May 12 17:36:24 BST 2011


On Wed, May 11, 2011 at 10:24:44PM +0200, Sebastian Spaeth wrote:
> On Wed, 11 May 2011 22:10:56 +0200, Nicolas Sebrecht <nicolas.s-dev at laposte.net> wrote:
> > The semaphorewait()/waitforthread() logic is usefull for IMAP starting
> > connections. We actually use it in imapserver only.
> > -        threadutil.semaphorewait(self.semaphore)
> > +        self.semaphore.acquire()
> > +        self.semaphore.release()
> 
> Reviewed-by: Sebastian Spaeth <Sebastian at SSpaeth.de>
> 
> The patch is ok, but in the longer term, I would love to rename the
> variable self.semaphore to something more useful. It is a semaphore for
> WHAT? That is a very useless name ...

It's a bit worse than that because self.semaphore is not a true
threading.Semaphore() but a threading.BoundedSemaphore().

About the name, I think care much as long as it's not misleading. We
know what a semaphore is and keeping the name generic doesn't hurt me.

-- 
Nicolas Sebrecht




More information about the OfflineIMAP-project mailing list