about summary refs log tree commit diff
path: root/src/libcore/task.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/libcore/task.rs')
-rw-r--r--src/libcore/task.rs40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/libcore/task.rs b/src/libcore/task.rs
index bee810fceba..ced39ef067b 100644
--- a/src/libcore/task.rs
+++ b/src/libcore/task.rs
@@ -158,6 +158,46 @@ enum SchedMode {
     PlatformThread
 }
 
+impl SchedMode : cmp::Eq {
+    pure fn eq(&&other: SchedMode) -> bool {
+        match self {
+            SingleThreaded => {
+                match other {
+                    SingleThreaded => true,
+                    _ => false
+                }
+            }
+            ThreadPerCore => {
+                match other {
+                    ThreadPerCore => true,
+                    _ => false
+                }
+            }
+            ThreadPerTask => {
+                match other {
+                    ThreadPerTask => true,
+                    _ => false
+                }
+            }
+            ManualThreads(e0a) => {
+                match other {
+                    ManualThreads(e0b) => e0a == e0b,
+                    _ => false
+                }
+            }
+            PlatformThread => {
+                match other {
+                    PlatformThread => true,
+                    _ => false
+                }
+            }
+        }
+    }
+    pure fn ne(&&other: SchedMode) -> bool {
+        !self.eq(other)
+    }
+}
+
 /**
  * Scheduler configuration options
  *