+void Scheduler::set_enabled(Thread *t, bool enabled_status) {
+ int threadid=id_to_int(t->get_id());
+ if (threadid>=enabled_len) {
+ bool *new_enabled = (bool *)snapshot_malloc(sizeof(bool) * (threadid + 1));
+ memset(&new_enabled[enabled_len], 0, (threadid+1-enabled_len)*sizeof(bool));
+ if (is_enabled != NULL) {
+ memcpy(new_enabled, is_enabled, enabled_len*sizeof(bool));
+ snapshot_free(is_enabled);
+ }
+ is_enabled=new_enabled;
+ enabled_len=threadid+1;
+ }
+ is_enabled[threadid]=enabled_status;
+}
+
+/**
+ * Add a Thread to the scheduler's ready list.
+ * @param t The Thread to add
+ */