# How to lock thread in haxe?

**URL:** <https://community.haxe.org/t/how-to-lock-thread-in-haxe/2086>\
**Category:** Haxe\
**Created:** [October 18, 2019, 9:42am UTC](https://community.haxe.org/t/how-to-lock-thread-in-haxe/2086 "2019-10-18T09:42:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Zhan](https://community.haxe.org/user_avatar/community.haxe.org/zhan/32/468_2.png) [@Zhan](https://community.haxe.org/u/Zhan)\
**Post date:** [October 18, 2019, 9:42am UTC](https://community.haxe.org/t/how-to-lock-thread-in-haxe/2086/1 "2019-10-18T09:42:30Z")

</div>

how to lock thread in haxe ?

---

<div class="post-metadata">

**Author:** ![RobDangerous](https://community.haxe.org/user_avatar/community.haxe.org/robdangerous/32/55_2.png) [@RobDangerous](https://community.haxe.org/u/RobDangerous)\
**Post date:** [October 18, 2019, 12:01pm UTC](https://community.haxe.org/t/how-to-lock-thread-in-haxe/2086/2 "2019-10-18T12:01:54Z")

</div>

Not sure what locking a thread is but maybe you just wanted to ask for a mutex. You can use [sys.thread.Mutex - Haxe development API](https://api.haxe.org/v/development/sys/thread/Mutex.html) in Haxe 4, in Haxe 3 you still have to use target-specific APIs like [cpp.vm.Mutex - Haxe 4.2.1 API](https://api.haxe.org/cpp/vm/Mutex.html). If it’s a semaphore you’re after you’re sadly out of luck.

---

<div class="post-metadata">

**Author:** ![Zhan](https://community.haxe.org/user_avatar/community.haxe.org/zhan/32/468_2.png) [@Zhan](https://community.haxe.org/u/Zhan)\
**Post date:** [October 18, 2019, 12:56pm UTC](https://community.haxe.org/t/how-to-lock-thread-in-haxe/2086/3 "2019-10-18T12:56:47Z")

</div>

thanks @RobDangerous,that’s what I find
