[erlang-questions] multi-threaded woes

Vlad Dumitrescu <>
Mon Sep 18 11:00:05 CEST 2006

On 9/18/06, Bob Cowdery <> wrote:
> I am having some trouble getting two C nodes which are both clients and servers to connect both ways and not sure of the rules here.
> I do need these nodes to be servers as multiple nodes will connect to them and I will need to spawn a thread for each.


I don't know what kind of application you work on, so this may be way
off. Also, I hope I understood your question.

If you want to write C nodes that are multithreaded, you will have to
fight the same problems any multithreaded C application has and that
Erlang solves. C nodes are regular C programs, they can talk to Erlang
nodes but have no inherent better multithreading capabilities.

An alternative approach (a little more Erlang-ish) would be to move
the connection handling to a proper Erlang node and let only that node
talk to the C node. This way the C part will be single-threaded (but
maybe will have to be able to handle several sessions) and the messy
threaded stuff is handled on the Erlang side.

Hope this helps.
best regards,

More information about the erlang-questions mailing list