[erlang-questions] Understanding global:set_lock/1,2,3

Roberto Ostinelli roberto@REDACTED
Thu Dec 10 12:16:29 CET 2015

Dear list,
I'm trying to get an understanding of what global:set_lock/1,2,3 exactly

I read from the docs:

Sets a lock on the specified nodes (or on all nodes if none are specified)
on ResourceId for LockRequesterId.

Let's say that I want to perform a series of operations on mnesia schemas
and want to avoid all other nodes accessing mnesia tables while one node is
busy at it.

Is it enough to write:

global:trans({{?MODULE, lock_mnesia_for_a_while}, self()},
    fun() ->

I don't get how this could lock mnesia for the other nodes.

Can some kind soul point me in the right direction?

Thank you,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20151210/1fb0dd08/attachment.htm>

More information about the erlang-questions mailing list