[erlang-questions] multi-threaded woes
Vlad Dumitrescu
vladdu55@REDACTED
Mon Sep 18 11:00:05 CEST 2006
On 9/18/06, Bob Cowdery <Bob.Cowdery@REDACTED> 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.
...snip...
> 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.
Hi,
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,
Vlad
More information about the erlang-questions
mailing list