[Spread-users] Designing a multithreaded app

Yuval Lifshitz ylifshitz at cablematrix.com
Wed Nov 2 01:14:56 EST 2005


John,
A mailbox is a socket, so the best way, in a single process, is to use a single socket. Note, that you must protect it, so in 
order to prevent thread synchronization over the "SP_multicast" (blocking call) critical section, it is better to have a single 
thread that uses the mailbox for sending, while all other threads write messages into somekind of queue it has.
If you want a single process to connect to more than one daemon, you would need several mailboxes and SP_connect calls.

Yuval.

John David Duncan wrote:
> Hi,
> 
> I'm about to start working on a multi-threaded Spread application for  
> the first time, and I have a very basic question:
> 
> How many times do I call SP_connect()? Do I connect once and get a  
> single mailbox that all threads can share, or should each thread  
> connect inidvidually?
> 
> Thanks,
> 
> JD
> 
> 
> 
> _______________________________________________
> Spread-users mailing list
> Spread-users at lists.spread.org
> http://lists.spread.org/mailman/listinfo/spread-users
> 
> .
> 





More information about the Spread-users mailing list