This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open Lwt.Infix | |
exception Source_terminated | |
type 'a node = N of ('a * 'a node Lwt.t) | |
type 'a t = 'a node Lwt.t | |
let push ref_waker v = | |
let new_node, new_waker = Lwt.wait () in |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module TestStream = Nstream | |
let n_stream = 1_000 (* # of items to pre-load stream. *) | |
let n_threads = 1_000 (* # of threads reading the stream. *) | |
let s = | |
let s, p = TestStream.create () in | |
begin | |
for ii = 1 to n_stream do | |
p (Some ii) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open Lwt.Infix | |
exception End_of_stream | |
type 'a node = N of 'a * 'a node Lwt.t | |
type 'a t = 'a node Lwt.t ref | |
let push ref_waker v = | |
let new_node, new_waker = Lwt.wait () in |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exception End_of_stream | |
type 'a t | |
val create : unit -> 'a t * ('a -> unit) | |
val clone : 'a t -> 'a t | |
val next : 'a t -> 'a Lwt.t | |
val iter : ('a -> unit Lwt.t) -> 'a t -> unit Lwt.t |