| 1 |
(* scheduler-hooks.sml |
| 2 |
* 2004 Matthew Fluet ([email protected]) |
| 3 |
* Ported to MLton threads. |
| 4 |
*) |
| 5 |
|
| 6 |
(* scheduler.sml |
| 7 |
* |
| 8 |
* COPYRIGHT (c) 1995 AT&T Bell Laboratories. |
| 9 |
* COPYRIGHT (c) 1989-1991 John H. Reppy |
| 10 |
*) |
| 11 |
|
| 12 |
structure SchedulerHooks: SCHEDULER_HOOKS = |
| 13 |
struct |
| 14 |
datatype thread = datatype RepTypes.thread |
| 15 |
type rdy_thread = RepTypes.rdy_thread |
| 16 |
|
| 17 |
val pauseHookDefault : unit -> rdy_thread = |
| 18 |
fn _ => raise Fail "SchedulerHooks.pauseHook" |
| 19 |
val pauseHook = ref pauseHookDefault |
| 20 |
|
| 21 |
val shutdownHookDefault : (bool * OS.Process.status) thread = |
| 22 |
THRD (ThreadID.bogus "shutdownHook", MLton.Thread.new (fn _ => |
| 23 |
raise Fail "SchedulerHooks.shutdownHook")) |
| 24 |
val shutdownHook = ref shutdownHookDefault |
| 25 |
|
| 26 |
fun reset () = |
| 27 |
(pauseHook := pauseHookDefault |
| 28 |
; shutdownHook := shutdownHookDefault |
| 29 |
; ()) |
| 30 |
end |