multi-threaded modules in parabellym

Justin Forest <[email protected]> Sun, 16 Jan 2005 01:29:52 +0300
Newsgroups gmane.comp.misc.faerion.devel
Message-ID <[email protected]>
Wake up.

So I had to eliminate the limitation of only the main module thread 
(MMT) being able to exchange messages.  The module subsystem was 
rearranged and partially rewritten, it is now more lean and clean. 
Summary of the changes:

1. Any thread can send messages.  Only the MMT can receive (and thus 
reply to) them, though.  The rest ("distrophic threads", DT) can only 
send messages at this moment.

2. Only the loader can load and unload modules.  The loader is the 
thread that was first to call the library.  It can not receive messages, 
too.

3. Modules can be loaded as many times as needed.  Modules that must 
only be loaded once must enforce this restriction on their own (a matter 
of a single static variable).

The documentation was also updated to represent the current state of 
affairs.  What has little to do with reality, such as notions of a 
"distributed environment", was censored out.  There is also less 
redundancy now.  The "library" section of function descriptions was 
replaced with "access".

What I'm thinking of now is an ability for multiple threads to receive 
messages from a single message queue.  This would make DTs and MMTs 
equal.  This way multi-threaded modules would actually make sense. 
(Imagine a module which spawns X threads, each connected to a database; 
DB connection pooling made easy.)

What I need is a good idea on how to authenticate threads to prevent 
message hijacking.  Perhaps I'll use the modid parameter of 
para_mod_body() and add a function, say, para_msg_attach(), but if 
anybody has a better idea, step out.


-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
-------------------------------------------------------
Discussions in this list are held in two languages: English and Russian.
When replying, please use the language that the sender of the original
message is guaranteed to understand, or use English.