# Is there a mutex for Motoko?

**URL:** <https://forum.dfinity.org/t/is-there-a-mutex-for-motoko/20031>\
**Category:** Motoko\
**Created:** [May 16, 2023, 12:09pm UTC](https://forum.dfinity.org/t/is-there-a-mutex-for-motoko/20031 "2023-05-16T12:09:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![qwertytrewq](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/qwertytrewq/32/10423_2.png) [@qwertytrewq](https://forum.dfinity.org/u/qwertytrewq)\
**Post date:** [May 16, 2023, 12:09pm UTC](https://forum.dfinity.org/t/is-there-a-mutex-for-motoko/20031/1 "2023-05-16T12:09:56Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Vivienne](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/vivienne/32/29170_2.png) [@Vivienne](https://forum.dfinity.org/u/Vivienne)\
**Post date:** [May 16, 2023, 12:25pm UTC](https://forum.dfinity.org/t/is-there-a-mutex-for-motoko/20031/2 "2023-05-16T12:25:55Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![andreea](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/andreea/32/10361_2.png) [@andreea](https://forum.dfinity.org/u/andreea)\
**Post date:** [May 22, 2023, 3:34pm UTC](https://forum.dfinity.org/t/is-there-a-mutex-for-motoko/20031/3 "2023-05-22T15:34:15Z")

</div>

As Severin mention there is no such thing as mutex in Motoko. An easy way to find is by using [Querio](https://querio.io/). Just select \</\>Code and type in mo:mutex . More details on the [forum](https://forum.dfinity.org/t/querio-code-search-is-live-and-can-search-within-the-entire-icp-ecosystem/20153).
