# Thread sanitiser v mutex

**URL:** <https://forums.swift.org/t/thread-sanitiser-v-mutex/54515>\
**Category:** Using Swift\
**Tags:** data-race, thread, mutex, thread-sanitizer\
**Created:** [January 8, 2022, 6:14pm UTC](https://forums.swift.org/t/thread-sanitiser-v-mutex/54515 "2022-01-08T18:14:46Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![tclementdev](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/tclementdev/32/13398_2.png) [@tclementdev](https://forums.swift.org/u/tclementdev)\
**Post date:** [January 8, 2022, 7:26pm UTC](https://forums.swift.org/t/thread-sanitiser-v-mutex/54515/2 "2022-01-08T19:26:27Z")

</div>

Then [again](https://forums.swift.org/t/best-practices-for-operating-on-a-buffer-in-parallel/54484/14), you cannot use the ampersand operator with `pthread_mutex_lock()` (and generally with low-level locks and atomics). This is a programming error that everybody makes. See [this](https://github.com/apple/swift-evolution/blob/master/proposals/0282-atomics.md#interaction-with-implicit-pointer-conversions), [this](http://www.russbishop.net/the-law) and [this](https://developer.apple.com/forums/thread/674633).

---

_[View the full topic](https://forums.swift.org/t/thread-sanitiser-v-mutex/54515)._
