2 * 2004 Matthew
Fluet (mfluet@acm
.org
)
3 * Ported to MLton threads
.
8 * COPYRIGHT (c
) 1995 AT
&T Bell Laboratories
.
9 * COPYRIGHT (c
) 1989-1991 John H
. Reppy
11 * These are the concrete representations
of the various CML types
.
12 * These types are
abstract (or not even visible
) outside this library
.
17 (** transaction IDs
-- see trans
-id
.sml
*)
18 datatype trans_id
= TXID
of trans_id_state ref
23 (** condition variables
--- see cvar
.sml
and events
.sml
*)
24 datatype cvar
= CVAR
of cvar_state ref
26 CVAR_unset
of {transId
: trans_id
,
27 cleanUp
: unit
-> unit
,
28 thread
: rdy_thread
} list
31 (** thread IDs
--- see thread
-id
.sml
and threads
.sml
**)
36 (* true, if there is a pending alert on this thread
*)
38 (* set this whenever this thread does some concurrency operation
. *)
40 (* root
-level
exception handler hook
*)
41 exnHandler
: (exn
-> unit
) ref
,
42 (* holds thread
-local properties
*)
44 (* the cvar that becomes set when the thread dies
*)
48 (** threads
--- see scheduler
.sml
and threads
.sml
**)
49 and 'a thread
= THRD
of thread_id
* 'a MLton
.Thread
.t
50 and rdy_thread
= RTHRD
of thread_id
* MLton
.Thread
.Runnable
.t
52 (** events
--- see events
.sml
**)
54 ENABLED
of {prio
: int, doitFn
: unit
-> 'a
}
55 | BLOCKED
of {transId
: trans_id
,
56 cleanUp
: unit
-> unit
,
57 next
: unit
-> rdy_thread
} -> 'a
58 type 'a base
= unit
-> 'a status
61 | CHOOSE
of 'a event list
62 | GUARD
of unit
-> 'a event
63 | WNACK
of unit event
-> 'a event