Concurrency problem

Pekka.Hedqvist@REDACTED Pekka.Hedqvist@REDACTED
Thu Aug 5 05:43:03 CEST 1999


And in some cases it can be convenient to use the
'gen_server:reply(To, Reply)' call in a handle_call 
instead to make an explicit reply to the caller and 
then go on doing something..

Torbjorn Tornkvist writes:
 > 
 > > 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