[erlang-questions] multi-threaded woes

Bob Cowdery <>
Mon Sep 18 10:36:01 CEST 2006


I have come a long way with ei now but the last 10% is giving me some grief.

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. They both start listen threads and sit on accept. Node 1 does a connect on node 2 which is successful and sends it a message which it receives. Node 2 does a connect on Node 1 as Node 1 is now guaranteed to be up, which is successful from the connect side except Node 1 never comes off the accept so it never sees it. The connects are done from the main thread on each side.I will give the clients their own threads but want to understand the issues before I proceed. 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. The only info I could find in the Erl_interface manual was to use -DREENTRANT and I am using pthreads package which should be the default.

One thing I'm not sure about but probably isn't related. If I am using the ei module rather than the erl module from a multi-threaded C node do I still need to call erl_init() and if so does it matter which thread I call it from. At the moment I've just realized it gets called twice, once on each thread.

I didn't get any response to my last post when I was stuggling with the binary format. Pleased to report that works a treat now and is very concise. I just hope someone uses this library in anger and can help me out here.
 
Regards
Bob





More information about the erlang-questions mailing list