[Spread-users] SP_join from different tread as SP_receive
John Schultz
jschultz at spreadconcepts.com
Fri Jun 15 16:18:14 EDT 2007
Yes, you are mistaken. ;)
So long as you use a thread safe version of the client library a mailbox
can be shared between multiple sending and multiple recieving threads,
although the particular order of their sends/recvs is arbitrary, which can
be particularly undesirable on receive.
You do need to be careful about closing/killing a mailbox though as you
can cause a race condition if other connections are being created in
parallel. For example, a thread is using mailbox #X, another thread
closes mailbox #X, (another thread) creates a new mailbox and the OS
assigns it file descriptor #X and the original thread then uses mailbox #X
oblivious to the fact that it actually is a different connection (e.g. -
different private name, different group subscriptions, etc.).
Spread 4 will only close a mailbox/fd in response to a close or kill call
from a user on it. Spread 3 would close a mailbox/fd in response to any
unrecoverable error on it. So with Spread 3 there is an unavoidable race
condition (if you are creating connections in parallel).
Cheers!
---
John Schultz
Spread Concepts
Phn: 443 838 2200
On Fri, 15 Jun 2007, Alec H. Peterson wrote:
> Hi John,
>
> --On June 15, 2007 16:01:02 -0400 John Schultz <jschultz at spreadconcepts.com>
> wrote:
>
>> Spread is thread safe so long as you use the proper client library.
>
> Hmm, I thought a single mailbox wasn't valid across multiple threads, am I
> mistaken?
>
> Alec
>
>
More information about the Spread-users
mailing list