Erl Ports and Threads
klacke@REDACTED
klacke@REDACTED
Thu Dec 16 10:38:38 CET 2004
On Thu, Dec 16, 2004 at 03:37:34PM +0600, Casper wrote:
> Hi Klacke,
>
> Thanks for the response.
>
> Here I am not talking about simultaneous write() operations on a socket/pipe
> from the multiple external program. I am talking about multiple threads in
> one program.
I know, that's what you wrote.
>
> Is single write() call, atomic or not?
>
Not.
> If that's not thread safe, what's the best way to go for inter-operability?
Let the write routine take a lock on a mutex before
it writes and release the lock when the write (which must
be performed in a loop until everything is written) is
finished.
Read man pages for read/write and pthread_mutex_init, lock
and friends.
/klacke
--
Claes Wikstrom -- Caps lock is nowhere and
http://www.hyber.org -- everything is under control
More information about the erlang-questions
mailing list