2 * 2004 Matthew
Fluet (mfluet@acm
.org
)
3 * Ported to MLton threads
.
8 * COPYRIGHT (c
) 1996 AT
&T Research
.
12 structure Result
:> RESULT
=
15 structure SV
= SyncVar
17 datatype 'a result_val
= EXN
of exn | RES
of 'a
19 type 'a result
= 'a result_val SV
.ivar
21 fun result () = SV
.iVar()
22 fun put (iv
, v
) = SV
.iPut(iv
, RES v
)
23 fun putExn (iv
, ex
) = SV
.iPut(iv
, EXN ex
)
25 |
wrap (EXN ex
) = raise ex
26 fun get iv
= wrap(SV
.iGet iv
)
27 fun getEvt iv
= CML
.wrap(SV
.iGetEvt iv
, wrap
)