[sword-devel] SWORD multi-session/thread support

Manfred Bergmann manfred.bergmann at me.com
Fri Jul 30 00:54:11 MST 2010


Hi.

Vadim's question in sword-support made me think a little.
SWMgr being or used as a singleton is fine. Somewhere there is always as synchronisation point.
But if I'm not mistaken the modules you get via the list are all the same instances. I mean, suppose there are two threads, each retrieve the same module from SWMgr.
They do both retrieve the same module instance, don't they?
Now if both want to iterate over the module this will cause problems. In MacSword/PocketSword we use semaphores to lock the modules so that no two threads can position and pull text at the same time. This however is very bad for multi-threaded environments like a web application is.
Is there a way to retrieve different instances of modules from SWMgr? Or can there be multiple instances of SWMgr?



Manfred



More information about the sword-devel mailing list