[erlang-questions] How to break out from mnesia transaction?

Fredrik Thulin <>
Mon Feb 5 15:14:28 CET 2007


 wrote:
> Hello!
> 
> I have to implement function a() which have to call function b().
> Function a() is always called from a mnesia transaction, while function
> b() can't be called from a mnesia transaction. How can I solve this
> problem elegantly? My idea is start a process from a(), send a message
> to the process, which in turn will call b() (it's now outside of the
> transaction, right?) and when b() returns, the process sends back a
> message to a(). Is there a simpler way to solve the problem?
> 
>  				Bye,NAR

If you have something that can't run inside a transaction, you can't run 
it inside a transaction.

Have the transaction return a value that makes the code that invoked the 
transaction invoke b() when the transaction has completed.

/Fredrik




More information about the erlang-questions mailing list