+/* The state of the scheduler. This is used to control the sequence
+ * of events during shutdown, and when the runtime is interrupted
+ * using ^C.
+ */
+#define SCHED_RUNNING 0 /* running as normal */
+#define SCHED_INTERRUPTING 1 /* ^C detected, before threads are deleted */
+#define SCHED_INTERRUPTED 2 /* ^C detected, after threads deleted */
+#define SCHED_SHUTTING_DOWN 3 /* final shutdown */
+
+extern rtsBool RTS_VAR(sched_state);
+
+/*
+ * flag that tracks whether we have done any execution in this time slice.
+ */
+#define ACTIVITY_YES 0 /* there has been activity in the current slice */
+#define ACTIVITY_MAYBE_NO 1 /* no activity in the current slice */
+#define ACTIVITY_INACTIVE 2 /* a complete slice has passed with no activity */
+#define ACTIVITY_DONE_GC 3 /* like 2, but we've done a GC too */
+
+/* Recent activity flag.
+ * Locks required : Transition from MAYBE_NO to INACTIVE
+ * happens in the timer signal, so it is atomic. Trnasition from
+ * INACTIVE to DONE_GC happens under sched_mutex. No lock required
+ * to set it to ACTIVITY_YES.
+ */
+extern nat recent_activity;