On 03:25 pm, firstname.lastname@example.org wrote:
The reason is that is you call a blocking C api in the thread, the Python interpreter will not be able to switch threads until the blocking C calls....unless the C code releases the Global Interpreter Lock. Thus you have two choices: (1 and 2 snipped) The way we usually handle this is to make a separate process that manages a queue of commands to be executed on the server. Clients then connect to this manager, which in turns submits them to the actual PB server at the appropriate time. This is a pain, but it works extremely well.
That sounds like a viable "third choice", and I have a fourth ;).
Have the PB server itself spawn a subprocess (or multiple subprocesses!) dedicated to this particular API. Then simply block in that (those) subprocess(es), and return Deferreds from your PB methods that wait for those requests to complete.
That way the PB server remains self-contained and you don't add the administrative overhead of setting up a separate server.
Thanks for all the great suggestions. Because of some restrictions imposed by the C api, I think I will try out the spawning of subprocesses. I don't suppose PB does IPC by any chance? :) Steve _________________________________________________________________ Need a brain boost? Recharge with a stimulating game. Play now! http://club.live.com/home.aspx?icid=club_hotmailtextlink1