Erl Ports and Threads
Thu Dec 16 10:03:53 CET 2004
On Thu, Dec 16, 2004 at 09:54:52AM +0600, Casper wrote:
> Hi all,
> I am wondering, is Erlang Ports are thread safe?
> I'm planning to use Erl Interface based Erlang Port. If communicates
> with the Erlang node over Standard Input and Output. The communication
> message has 2 bytes header indicating the length of the message
> followed by the encoded message. If the C program has multiple threads
> and if they write to the stdout at the same time, will there be any
> communication problem?
This will ofcourse wreak major havoc. You have to synchronize
the output from your threads.
It's just a pipe between erlang and the external C-program and
erlang will just sit there reading data.
write() operations on a socket/pipe from the external program
are not atomic in unix/linux.
Claes Wikstrom -- Caps lock is nowhere and
http://www.hyber.org -- everything is under control
More information about the erlang-questions