On Fri, Mar 09, 2007 at 12:54:59AM +0200, Jamshed Qureshi wrote: > Hi Andrew, > During a forum discussion i got the following information from the > author of twapi: > > https://sourceforge.net/forum/message.php?msg_id=4193122 > <quote> > The issue is that the low level Win32<->Tcl bindings source code is > generated using SWIG (see swig.org). The generated code is not in > theory thread-safe (no locks around global structures etc.). I can't > really fix this easily because I would have to go and change the SWIG > code generator itself. > > At the same time, as far as I can tell the global structures are > initialized and not modified thereafter. Furthermore, initialization > is protected by a boolean (albeit without locked access). So there is > a good chance it will "mostly" work but I can't really guarantee it. > </quote> > > What's your opinion on this?
Does your app really need to have more than one twapi call active at any given time? I suspect the answer is no - aka, single threaded twapi is functionally good enough for you, the only question is whether including the twapi code in your multi-threaded AOLserver process will break stuff or not. I would first try just putting one great big mutex lock around ALL calls to TWAPI. And cross my fingers and hope that TWAPI is not calling any nasty non-thread-safe Windows APIs underneath. Then try it. You've a fair shot of it just working. If that "single big mutex" approach works, down the road you could get even more aggressive, and experiment with allowing multiple concurrent twapi calls in some fashion. But you may never have any reason to go there. If the "single big mutex" approach does NOT work, if it gives you mysterious failures or race conditions, then I think you have two choices: 1. Track down and fix the thread-safety problems. Or, 2. Move twapi out into its own process. Have AOLserver send each twapi process messages telling it to do stuff. AOLserver includes a special "nsproxy" module for doing exactly that sort of thing. You could also start out trying nsproxy. That would also let you run as many concurrent nsproxy/twapi processes as you want, with no fear of thread-safety issues. I don't know if anyone has ever used nsproxy on MS Windows, though: http://www.mail-archive.com/[email protected]/msg10094.html http://www.mail-archive.com/[email protected]/msg10170.html -- Andrew Piskorski <[EMAIL PROTECTED]> http://www.piskorski.com/ -- AOLserver - http://www.aolserver.com/ To Remove yourself from this list, simply send an email to <[EMAIL PROTECTED]> with the body of "SIGNOFF AOLSERVER" in the email message. You can leave the Subject: field of your email blank.
