[Twisted-Python] mutexes in twisted.enterprise?

Andrew Bennetts andrew-twisted at puzzling.org
Thu Apr 18 21:32:50 EDT 2002

On Thu, Apr 18, 2002 at 09:14:28PM -0400, Bob Ippolito wrote:
> Well see the thing is that yes, the db supports transactions [postgres], 
> but I need to make sure the db processes requests in the order that 
> they're received over the wire, not whenever that particular db 
> connection gets around to it.

Ok.  Well, mutexes aren't going to guarantee order, either.  IIRC,
there's no guarantee that mutexes will be woken in the order they called
.acquire().  I'd recommend that the network reading thread pushes the
data onto a Queue.Queue that is being popped by a DB thread.  If this is
all you are doing with the DB, then perhaps you don't even need
twisted.enterprise, which is more designed for getting data than
inserting it.

I actually have a module somewhere that basically does exactly that, and
returns Deferreds that trigger when individual data items are inserted.
I might see if I can find it, and if it is not too specific that I can
post it.

> I don't think I'm currently having issues w/ it right now, but I'm just 
> concerned that potentially it could be a problem someday.

Yeah, best to be cautious.  That sort of bug can be hell to track down
later on :(


More information about the Twisted-Python mailing list