Ajout de Event.always

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@1834 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
master
Xavier Leroy 1997-12-09 09:10:23 +00:00
parent 3fda2b9b90
commit 5d095a5e35
2 changed files with 9 additions and 0 deletions

View File

@ -127,6 +127,12 @@ let poll ev =
(* Event construction *)
let always data =
Communication(fun performed condition evnum ->
{ poll = (fun () -> performed := evnum; true);
suspend = (fun () -> ());
result = (fun () -> data) })
let send channel data =
Communication(fun performed condition evnum ->
let wcomm =

View File

@ -32,6 +32,9 @@ val receive: 'a channel -> 'a event
(* [receive ch] returns the event consisting in receiving a value
from the channel [ch]. The result value of this event is the
value received. *)
val always: 'a -> 'a event
(* [always v] returns an event that is always ready for
synchronization. The result value of this event is [v]. *)
val choose: 'a event list -> 'a event
(* [choose evl] returns the event that is the alternative of
all the events in the list [evl]. *)