Concurrency problem

Torbjorn Tornkvist <>
Thu Aug 5 04:00:39 CEST 1999


> So, it seems to me that if A makes a gen_server:call to B, then when B 
> does the same back to A, it will get a cycle in the call graph and
> deadlock.  

Yes, and to avoid that you can either:

 1. Use gen_server:cast/2 .
 2. Spawn of a new process P which does the the gen_server:/call 
    to B, and then relay the answer back to A.

In both cases you have to be make sure you can receive those 
messages (from P and B) in A.

Cheers /Tobbe



More information about the erlang-questions mailing list