about summary refs log tree commit diff
path: root/src/libsync
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2014-10-06 16:14:30 -0700
committerAlex Crichton <alex@alexcrichton.com>2014-10-09 09:44:51 -0700
commit1a433770e3141c476a7ac5b12cfdc15be022073e (patch)
tree5e1b5691a9c6ac30a804a1e90317b6af13e47ec1 /src/libsync
parent4d87af9dce7b53a90ae9f6a84c14c61c4849cd2e (diff)
downloadrust-1a433770e3141c476a7ac5b12cfdc15be022073e.tar.gz
rust-1a433770e3141c476a7ac5b12cfdc15be022073e.zip
sync: Convert statics to constants
Diffstat (limited to 'src/libsync')
-rw-r--r--src/libsync/comm/oneshot.rs6
-rw-r--r--src/libsync/comm/shared.rs8
-rw-r--r--src/libsync/comm/stream.rs6
-rw-r--r--src/libsync/mutex.rs8
-rw-r--r--src/libsync/one.rs2
5 files changed, 15 insertions, 15 deletions
diff --git a/src/libsync/comm/oneshot.rs b/src/libsync/comm/oneshot.rs
index 5b3cf33ebf0..053b5dc4c8a 100644
--- a/src/libsync/comm/oneshot.rs
+++ b/src/libsync/comm/oneshot.rs
@@ -43,9 +43,9 @@ use atomic;
 use comm::Receiver;
 
 // Various states you can find a port in.
-static EMPTY: uint = 0;
-static DATA: uint = 1;
-static DISCONNECTED: uint = 2;
+const EMPTY: uint = 0;
+const DATA: uint = 1;
+const DISCONNECTED: uint = 2;
 
 pub struct Packet<T> {
     // Internal state of the chan/port pair (stores the blocked task as well)
diff --git a/src/libsync/comm/shared.rs b/src/libsync/comm/shared.rs
index cb35bd8afb7..cfd045d0882 100644
--- a/src/libsync/comm/shared.rs
+++ b/src/libsync/comm/shared.rs
@@ -31,12 +31,12 @@ use rustrt::thread::Thread;
 use atomic;
 use mpsc_queue as mpsc;
 
-static DISCONNECTED: int = int::MIN;
-static FUDGE: int = 1024;
+const DISCONNECTED: int = int::MIN;
+const FUDGE: int = 1024;
 #[cfg(test)]
-static MAX_STEALS: int = 5;
+const MAX_STEALS: int = 5;
 #[cfg(not(test))]
-static MAX_STEALS: int = 1 << 20;
+const MAX_STEALS: int = 1 << 20;
 
 pub struct Packet<T> {
     queue: mpsc::Queue<T>,
diff --git a/src/libsync/comm/stream.rs b/src/libsync/comm/stream.rs
index 36fe335128e..8e433c6a585 100644
--- a/src/libsync/comm/stream.rs
+++ b/src/libsync/comm/stream.rs
@@ -30,11 +30,11 @@ use atomic;
 use comm::Receiver;
 use spsc_queue as spsc;
 
-static DISCONNECTED: int = int::MIN;
+const DISCONNECTED: int = int::MIN;
 #[cfg(test)]
-static MAX_STEALS: int = 5;
+const MAX_STEALS: int = 5;
 #[cfg(not(test))]
-static MAX_STEALS: int = 1 << 20;
+const MAX_STEALS: int = 1 << 20;
 
 pub struct Packet<T> {
     queue: spsc::Queue<Message<T>>, // internal queue for all message
diff --git a/src/libsync/mutex.rs b/src/libsync/mutex.rs
index 12de615a81b..c6413d0d09c 100644
--- a/src/libsync/mutex.rs
+++ b/src/libsync/mutex.rs
@@ -70,9 +70,9 @@ use rustrt::thread::Thread;
 
 use mpsc_intrusive as q;
 
-pub static LOCKED: uint = 1 << 0;
-pub static GREEN_BLOCKED: uint = 1 << 1;
-pub static NATIVE_BLOCKED: uint = 1 << 2;
+pub const LOCKED: uint = 1 << 0;
+pub const GREEN_BLOCKED: uint = 1 << 1;
+pub const NATIVE_BLOCKED: uint = 1 << 2;
 
 /// A mutual exclusion primitive useful for protecting shared data
 ///
@@ -163,7 +163,7 @@ pub struct Guard<'a> {
 
 /// Static initialization of a mutex. This constant can be used to initialize
 /// other mutex constants.
-pub static MUTEX_INIT: StaticMutex = StaticMutex {
+pub const MUTEX_INIT: StaticMutex = StaticMutex {
     lock: mutex::NATIVE_MUTEX_INIT,
     state: atomic::INIT_ATOMIC_UINT,
     flavor: UnsafeCell { value: Unlocked },
diff --git a/src/libsync/one.rs b/src/libsync/one.rs
index 4594345d2a3..c740c4f3d2e 100644
--- a/src/libsync/one.rs
+++ b/src/libsync/one.rs
@@ -45,7 +45,7 @@ pub struct Once {
 }
 
 /// Initialization value for static `Once` values.
-pub static ONCE_INIT: Once = Once {
+pub const ONCE_INIT: Once = Once {
     mutex: MUTEX_INIT,
     cnt: atomic::INIT_ATOMIC_INT,
     lock_cnt: atomic::INIT_ATOMIC_INT,