about summary refs log tree commit diff
path: root/library/std/src/sys/unix/locks
AgeCommit message (Collapse)AuthorLines
2024-01-11std: begin moving platform support modules into `pal`joboet-1199/+0
2023-06-21Finish up preliminary tvos support in libstdThom Chiovoloni-0/+1
2023-06-21wip: Support Apple tvOS in libstdThom Chiovoloni-0/+2
2023-02-28Add QNX Neutrino support to libstdFlorian Bartels-0/+11
Co-authored-by: gh-tr <troach@qnx.com>
2022-12-02std: cleanup timeouts in pthread condvarjoboet-63/+30
2022-11-06std: fix double-free of mutexjoboet-1/+1
2022-11-06std: remove lock wrappers in `sys_common`joboet-251/+268
2022-09-20Auto merge of #100581 - joboet:sync_rwlock_everywhere, r=thomccbors-3/+3
std: use `sync::RwLock` for internal statics Since `sync::RwLock` is now `const`-constructible, it can be used for internal statics, removing the need for `sys_common::StaticRwLock`. This adds some extra allocations on platforms which need to box their locks (currently SGX and some UNIX), but these will become unnecessary with the lock improvements tracked in #93740.
2022-09-19std: use `sync::RwLock` for internal staticsjoboet-3/+3
2022-09-04Auto merge of #100576 - joboet:movable_const_remutex, r=Mark-Simulacrumbors-7/+1
Make `ReentrantMutex` movable and `const` As `MovableMutex` is now `const`, it can be used to simplify the implementation and interface of the internal reentrant mutex type. Consequently, the standard error stream does not need to be wrapped in `OnceLock` and `OnceLock::get_or_init_pin()` can be removed.
2022-09-03std: make `ReentrantMutex` movable and `const`; simplify `Stdout` initializationjoboet-7/+1
2022-08-31Fix a bunch of typoDezhi Wu-3/+3
This PR will fix some typos detected by [typos]. I only picked the ones I was sure were spelling errors to fix, mostly in the comments. [typos]: https://github.com/crate-ci/typos
2022-08-11promote debug_assert to assertVincenzo Palazzo-1/+1
Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
2022-07-21Rollup merge of #98707 - joboet:fuchsia_locks, r=m-ou-seMatthias Krüger-57/+235
std: use futex-based locks on Fuchsia This switches `Condvar` and `RwLock` to the futex-based implementation currently used on Linux and some BSDs. Additionally, `Mutex` now has its own, priority-inheriting implementation based on the mutex in Fuchsia's `libsync`. It differs from the original in that it panics instead of aborting when reentrant locking is detected. ````@rustbot```` ping fuchsia r? ````@m-ou-se````
2022-07-21remove unused importjoboet-1/+1
2022-07-20owner is not micro (correct typo)joboet-1/+1
2022-07-20Rollup merge of #98101 - vladimir-ea:stdlib_watch_os, r=thomccDylan DPC-0/+4
stdlib support for Apple WatchOS This is a follow-up to https://github.com/rust-lang/rust/pull/95243 (Add Apple WatchOS compiler targets) that adds stdlib support for Apple WatchOS. `@deg4uss3r` `@nagisa`
2022-07-20Library changes for Apple WatchOSVladimir Michael Eatwell-0/+4
2022-07-18std: panic instead of deadlocking in mutex implementation on Fuchsiajoboet-15/+15
2022-07-12std: fix issue with perma-locked mutexes on Fuchsiajoboet-9/+16
2022-06-30std: use futex-based locks on Fuchsiajoboet-57/+228
2022-06-25Rollup merge of #98194 - m-ou-se:leak-locked-pthread-mutex, r=AmanieuMatthias Krüger-1/+35
Leak pthread_{mutex,rwlock}_t if it's dropped while locked. Fixes https://github.com/rust-lang/rust/issues/85434.
2022-06-20Leak pthreax_rwlock_t when it's dropped while locked.Mara Bos-0/+16
2022-06-17Auto merge of #98143 - cuviper:futex-rwlock-inline, r=thomccbors-0/+9
Add `#[inline]` to small fns of futex `RwLock` The important methods like `read` and `write` were already inlined, which can propagate all the way to inlining in user code, but these small state functions were left behind as normal calls. They should almost always be inlined as well, as they're just a few instructions.
2022-06-16Leak pthreax_mutex_t when it's dropped while locked.Mara Bos-1/+19
2022-06-15Add `#[inline]` to small fns of futex `RwLock`Josh Stone-0/+9
The important methods like `read` and `write` were already inlined, which can propagate all the way to inlining in user code, but these small state functions were left behind as normal calls. They should almost always be inlined as well, as they're just a few instructions.
2022-06-13Use the right wait_timeout implementationAzureMarker-7/+7
Our condvar doesn't support setting attributes, like pthread_condattr_setclock, which the current wait_timeout expects to have configured. Switch to a different implementation, following espidf.
2022-06-13Horizon OS STD supportMeziu-3/+8
Co-authored-by: Ian Chamberlain <ian.h.chamberlain@gmail.com> Co-authored-by: Mark Drobnak <mark.drobnak@gmail.com>
2022-06-03Lazily allocate+initialize locks.Mara Bos-14/+36
2022-06-03Use Drop instead of destroy() for locks.Mara Bos-14/+26
2022-05-30Remove "sys isn't exported yet" phraseest31-1/+0
The oldest occurence is from 9e224c2bf18ebf8f871efb2e1aba43ed7970ebb7, which is from the pre-1.0 days. In the years since then, std::sys still hasn't been exported, and the last attempt was met with strong criticism: https://github.com/rust-lang/rust/pull/97151 Thus, removing the "yet" part makes a lot of sense.
2022-05-21Fix typo in futex RwLock::write_contended.Mara Bos-3/+2
I wrote `state` where I should've used `s`. This removes the unnecessary `s` variable to prevent that mistake. Fortunately, this typo didn't affect the correctness of the lock, as the second half of the condition (!has_writers_waiting) is enough for correctness, which explains why this mistake didn't show up during testing.
2022-05-03Don't use futexes on netbsd.Mara Bos-1/+0
The latest NetBSD release doesn't include the futex syscall yet.
2022-04-29Always return false in futex_wake on {Free,DragonFly}BSD.Mara Bos-12/+5
2022-04-29Use futex-based locks and thread parker on FreeBSD.Mara Bos-2/+3
2022-04-29Use futex-based locks and thread parker on DragonFlyBSD.Mara Bos-1/+13
2022-04-29Use futex-based locks and thread parker on NetBSD.Mara Bos-0/+1
2022-04-29Use futex-based locks and thread parker on OpenBSD.Mara Bos-0/+1
2022-04-19Use futex locks on emscripten.Mara Bos-0/+1
2022-04-16Use a single ReentrantMutex implementation on all platforms.Mara Bos-146/+2
2022-04-14Use u32 instead of i32 for futexes.Mara Bos-26/+26
2022-04-12Add debug asserts to futex ReentrantMutex impl.Mara Bos-0/+2
2022-04-12Initialize thread local with const{}.Mara Bos-1/+1
2022-04-12Move current_thread_unique_ptr to the only module that uses it.Mara Bos-1/+9
2022-04-12Add futex-based ReentrantMutex on Linux.Mara Bos-6/+88
2022-04-11Use is_ or has_ prefix for pure `-> bool` functions.Mara Bos-23/+25
2022-04-11Use compare_exchange_weak in futex rwlock implementation.Mara Bos-4/+11
2022-04-11Add comments to futex rwlock implementation.Mara Bos-1/+12
2022-04-08Fix typo in futex rwlock.Mara Bos-1/+1
Co-authored-by: Amanieu d'Antras <amanieu@gmail.com>
2022-04-08Add futex-based RwLock on Linux.Mara Bos-2/+295