Erl Ports and Threads

Chenniappan,Dhanasekaran [DBA] dhanasekaran.c@REDACTED
Thu Dec 16 11:58:26 CET 2004


Hi,
> If that's not thread safe, what's the best way to go for
inter-operability?

 I think, You may use the erl_interface for interoperability instead of
port.

With Regards
Dhanas.

-----Original Message-----
From: klacke@REDACTED [mailto:klacke@REDACTED] 
Sent: Thursday, December 16, 2004 3:09 PM
To: Casper
Cc: klacke@REDACTED; erlang-questions@REDACTED
Subject: Re: Erl Ports and Threads

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