Is there a mutex for Motoko?

Is there some kind of mutex that would make Motoko code execution uninterrupted during executing a function calling multiple canisters with await?

1 Like

If you really want to do that, you can use a simple bool that you toggle when you’re in a method. Otherwise there is no such thing in Motoko. But note that this will seriously limit the scalability of your canister

As Severin mention there is no such thing as mutex in Motoko. An easy way to find is by using Querio. Just select </>Code and type in mo:mutex . More details on the forum.