>>259は少し先走りすぎたかな。
じゃー、マルチスレッド状態で、複数のスレッドから読み書きできてかつ安全な変数"cell"を定義してみよう。

open Event
type 'a cell = { getCh : 'a channel; putCh : 'a channel }

let get { getCh = getCh } = sync (receive getCh)
let put { putCh = putCh } x = sync (send putCh x)
let cell x =
let getCh = new_channel () in
let putCh = new_channel () in
let rec loop x = select [
wrap (send getCh x) (fun () -> loop x);
wrap (receive putCh) loop
]
in
ignore (Thread.create loop x);
{ getCh = getCh; putCh = putCh }

let _ =
let c = cell 10 in
put c 20;
Printf.printf "v=%d\n" (get c)