On 8 February 2011 10:45, Jason Rennie <jren...@gmail.com> wrote: > I think what you have duplicating functionality---you're not taking > advantage of the DeferredSemaphore.
I thought using the "run" method *was* the preferred way to use a DS, but whatever works. > You'll want "sem" to be a global---use wherever you deal with a particular > port. There's one serial settings object for the life of the program (which, since it is initialised in my main entry point, is essentially global), and I'm happy to let it "own" the semaphore. Making the DS itself global won't really get me anything better than that. and Stephen Thorne... On 2011-02-07, Jason Rennie wrote: > > d = sem.acquire() > > d.addCallback(doSerialStuffAndRelease) > > Shouldn't this be spelled: > > d = sem.run(doSerialStuff) > > Which does acquasition and release of the sempahore properly? Won't you then be trying to acquire or release it twice? — Jason _______________________________________________ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python