method private get_block =
assert (match state with `Running _ | `Crashed -> true | _ -> false) ;
(* Check that the writer still has an advance. *)
Mutex.lock wait_m ;
if write = read && state <>`Crashed then
Condition.wait wait_c wait_m ;
let b = buffer.(read mod nb_blocks) in
read <- (read + 1) mod (2*nb_blocks) ;
Mutex.unlock wait_m ;
Condition.signal wait_c ;
b