diff options
| author | Simonas Kazlauskas <git@kazlauskas.me> | 2015-04-04 00:46:54 +0300 |
|---|---|---|
| committer | Simonas Kazlauskas <git@kazlauskas.me> | 2015-04-08 19:42:16 +0300 |
| commit | 45aa6c8d1bc2f7863c92da6643de4642bb2d83bf (patch) | |
| tree | 53f8648a696dc49072ceef53c36974f6fc599515 /src/libstd/sync/condvar.rs | |
| parent | 80def6c2447d23a624e611417f24cf0ab2a5a676 (diff) | |
| download | rust-45aa6c8d1bc2f7863c92da6643de4642bb2d83bf.tar.gz rust-45aa6c8d1bc2f7863c92da6643de4642bb2d83bf.zip | |
Implement reentrant mutexes and make stdio use them
write_fmt calls write for each formatted field. The default implementation of write_fmt is used, which will call write on not-yet-locked stdout (and write locking after), therefore making print! in multithreaded environment still interleave contents of two separate prints. This patch implements reentrant mutexes, changes stdio handles to use these mutexes and overrides write_fmt to lock the stdio handle for the whole duration of the call.
Diffstat (limited to 'src/libstd/sync/condvar.rs')
| -rw-r--r-- | src/libstd/sync/condvar.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/libstd/sync/condvar.rs b/src/libstd/sync/condvar.rs index a7d8b287a64..654b33f1a57 100644 --- a/src/libstd/sync/condvar.rs +++ b/src/libstd/sync/condvar.rs @@ -11,12 +11,12 @@ use prelude::v1::*; use sync::atomic::{AtomicUsize, Ordering, ATOMIC_USIZE_INIT}; -use sync::poison::{self, LockResult}; -use sys::time::SteadyTime; +use sync::{mutex, MutexGuard, PoisonError}; use sys_common::condvar as sys; use sys_common::mutex as sys_mutex; +use sys_common::poison::{self, LockResult}; +use sys::time::SteadyTime; use time::Duration; -use sync::{mutex, MutexGuard, PoisonError}; /// A Condition Variable /// |
