| 1 |
(* scheduler.sig |
| 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 |
signature SCHEDULER = |
| 13 |
sig |
| 14 |
include CRITICAL |
| 15 |
|
| 16 |
type thread_id = ThreadID.thread_id |
| 17 |
type 'a thread = 'a RepTypes.thread |
| 18 |
type rdy_thread = RepTypes.rdy_thread |
| 19 |
|
| 20 |
val prep : unit thread -> rdy_thread |
| 21 |
val prepVal : 'a thread * 'a -> rdy_thread |
| 22 |
val prepFn : 'a thread * (unit -> 'a) -> rdy_thread |
| 23 |
|
| 24 |
val getThreadId : 'a thread -> thread_id |
| 25 |
val getCurThreadId : unit -> thread_id |
| 26 |
val tidMsg : unit -> string |
| 27 |
|
| 28 |
val ready : rdy_thread -> unit |
| 29 |
val next : unit -> rdy_thread |
| 30 |
|
| 31 |
val switch : ('a thread -> rdy_thread) -> 'a |
| 32 |
val atomicSwitch : ('a thread -> rdy_thread) -> 'a |
| 33 |
val switchToNext : ('a thread -> unit) -> 'a |
| 34 |
val atomicSwitchToNext : ('a thread -> unit) -> 'a |
| 35 |
val readyAndSwitch : (unit -> rdy_thread) -> unit |
| 36 |
val atomicReadyAndSwitch : (unit -> rdy_thread) -> unit |
| 37 |
val readyAndSwitchToNext : (unit -> unit) -> unit |
| 38 |
val atomicReadyAndSwitchToNext : (unit -> unit) -> unit |
| 39 |
|
| 40 |
val new : (thread_id -> ('a -> unit)) -> 'a thread |
| 41 |
|
| 42 |
val prepend : 'a thread * ('b -> 'a) -> 'b thread |
| 43 |
val unwrap : (rdy_thread -> rdy_thread) -> |
| 44 |
(MLton.Thread.Runnable.t -> MLton.Thread.Runnable.t) |
| 45 |
|
| 46 |
val reset : bool -> unit |
| 47 |
val preempt : rdy_thread -> unit |
| 48 |
end |