about summary refs log tree commit diff
path: root/library/std/src/sys_common
diff options
context:
space:
mode:
authorMara Bos <m-ou.se@m-ou.se>2022-04-14 09:51:25 +0200
committerMara Bos <m-ou.se@m-ou.se>2022-04-14 11:44:12 +0200
commit7a35c0f52d2a37d3ce10772b07d7a45a445ebbf0 (patch)
tree67e565ff9babe48f7b85397bf971845ab5186765 /library/std/src/sys_common
parentf387c930ee7c84357f8fa9f4c38903c00404ac46 (diff)
downloadrust-7a35c0f52d2a37d3ce10772b07d7a45a445ebbf0.tar.gz
rust-7a35c0f52d2a37d3ce10772b07d7a45a445ebbf0.zip
Use u32 instead of i32 for futexes.
Diffstat (limited to 'library/std/src/sys_common')
-rw-r--r--library/std/src/sys_common/thread_parker/futex.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/library/std/src/sys_common/thread_parker/futex.rs b/library/std/src/sys_common/thread_parker/futex.rs
index 0132743b244..fbf6231ff4a 100644
--- a/library/std/src/sys_common/thread_parker/futex.rs
+++ b/library/std/src/sys_common/thread_parker/futex.rs
@@ -1,14 +1,14 @@
-use crate::sync::atomic::AtomicI32;
+use crate::sync::atomic::AtomicU32;
 use crate::sync::atomic::Ordering::{Acquire, Release};
 use crate::sys::futex::{futex_wait, futex_wake};
 use crate::time::Duration;
 
-const PARKED: i32 = -1;
-const EMPTY: i32 = 0;
-const NOTIFIED: i32 = 1;
+const PARKED: u32 = u32::MAX;
+const EMPTY: u32 = 0;
+const NOTIFIED: u32 = 1;
 
 pub struct Parker {
-    state: AtomicI32,
+    state: AtomicU32,
 }
 
 // Notes about memory ordering:
@@ -34,7 +34,7 @@ pub struct Parker {
 impl Parker {
     #[inline]
     pub const fn new() -> Self {
-        Parker { state: AtomicI32::new(EMPTY) }
+        Parker { state: AtomicU32::new(EMPTY) }
     }
 
     // Assumes this is only called by the thread that owns the Parker,