Small changes; slightly faster than tsan11rec in jsbench now
[c11tester.git] / schedule.cc
index f68786a825698f64052729f5032b332a3925e824..9bd87077af6801811ce0cc05fa9e39df8f70cabc 100644 (file)
@@ -102,7 +102,14 @@ bool Scheduler::is_enabled(thread_id_t tid) const
  */
 bool Scheduler::is_sleep_set(const Thread *t) const
 {
-       return get_enabled(t) == THREAD_SLEEP_SET;
+       return is_sleep_set(t->get_id());
+}
+
+bool Scheduler::is_sleep_set(thread_id_t tid) const
+{
+       int id = id_to_int(tid);
+       ASSERT(id < enabled_len);
+       return enabled[id] == THREAD_SLEEP_SET;
 }
 
 /**
@@ -206,7 +213,7 @@ Thread * Scheduler::select_next_thread()
        int thread_list[enabled_len], sleep_list[enabled_len];
        Thread * thread;
 
-       for (int i = 0; i < enabled_len; i++) {
+       for (int i = 0;i < enabled_len;i++) {
                if (enabled[i] == THREAD_ENABLED)
                        thread_list[avail_threads++] = i;
                else if (enabled[i] == THREAD_SLEEP_SET)