diff options
| author | bors <bors@rust-lang.org> | 2018-08-07 11:00:07 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2018-08-07 11:00:07 +0000 |
| commit | 18925dee25ce649562d203e72068e3a57b60b153 (patch) | |
| tree | cefb7c09f52e823aa3c03dc072d29cba51e52c2a /src/libstd | |
| parent | 9e472c2acea2b7714985390abb6b7fe420a4f346 (diff) | |
| parent | d9e9230b1d3ccb8eb0fe57d0e0a29e08f09292c3 (diff) | |
| download | rust-18925dee25ce649562d203e72068e3a57b60b153.tar.gz rust-18925dee25ce649562d203e72068e3a57b60b153.zip | |
Auto merge of #53150 - kennytm:rollup, r=kennytm
Rollup of 10 pull requests Successful merges: - #52885 (Remove some unused method arguments from typeck) - #52886 (cleanup: Remove `Def::GlobalAsm`) - #53028 (Building librustc_codegen_llvm in a separate directory) - #53052 (fixed broken links to char) - #53060 (Change rustdoc style so fully qualified name does not overlap src link) - #53068 (Rename Executor trait to Spawn) - #53093 (Enable macros to pass $:literal to another macro) - #53107 (Remove references to `StaticMutex` which got removed a while ago) - #53135 (Rust 2018: Disable catch_expr, not targeted for 2018 edition) - #53139 (set emit_debug_gdb_scripts: false for riscv32imac-unknown-none target)
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/sync/once.rs | 10 | ||||
| -rw-r--r-- | src/libstd/sys/unix/mutex.rs | 3 |
2 files changed, 4 insertions, 9 deletions
diff --git a/src/libstd/sync/once.rs b/src/libstd/sync/once.rs index 3abc260b458..f6cb8beae84 100644 --- a/src/libstd/sync/once.rs +++ b/src/libstd/sync/once.rs @@ -31,12 +31,10 @@ // initialization closure panics, the Once enters a "poisoned" state which means // that all future calls will immediately panic as well. // -// So to implement this, one might first reach for a `StaticMutex`, but those -// unfortunately need to be deallocated (e.g. call `destroy()`) to free memory -// on all OSes (some of the BSDs allocate memory for mutexes). It also gets a -// lot harder with poisoning to figure out when the mutex needs to be -// deallocated because it's not after the closure finishes, but after the first -// successful closure finishes. +// So to implement this, one might first reach for a `Mutex`, but those cannot +// be put into a `static`. It also gets a lot harder with poisoning to figure +// out when the mutex needs to be deallocated because it's not after the closure +// finishes, but after the first successful closure finishes. // // All in all, this is instead implemented with atomics and lock-free // operations! Whee! Each `Once` has one word of atomic state, and this state is diff --git a/src/libstd/sys/unix/mutex.rs b/src/libstd/sys/unix/mutex.rs index 52cf3f97c5c..60b03cdbeb0 100644 --- a/src/libstd/sys/unix/mutex.rs +++ b/src/libstd/sys/unix/mutex.rs @@ -49,9 +49,6 @@ impl Mutex { // references, we instead create the mutex with type // PTHREAD_MUTEX_NORMAL which is guaranteed to deadlock if we try to // re-lock it from the same thread, thus avoiding undefined behavior. - // - // We can't do anything for StaticMutex, but that type is deprecated - // anyways. let mut attr: libc::pthread_mutexattr_t = mem::uninitialized(); let r = libc::pthread_mutexattr_init(&mut attr); debug_assert_eq!(r, 0); |
