package bistro

  1. Overview
  2. Docs
A library to build and run distributed scientific workflows

Install

Dune Dependency

Authors

Maintainers

Sources

bistro-0.6.0.tbz
sha256=146177faaaa9117a8e2bf0fd60cb658662c0aa992f35beb246e6fd0766050e66
sha512=553fe0c20f236316449b077a47e6e12626d193ba1916e9da233e5526dd39090e8677277e1c79baace3bdc940cb009f25431730a8efc00ae4ed9cc42a0add9609

doc/src/bistro.engine/lwt_queue.ml.html

Source file lwt_queue.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
open Lwt.Infix
open Core_kernel

type 'a t = {
  queue : 'a Queue.t ;
  condition : unit Lwt_condition.t ;
}

let create () = {
  queue = Queue.create () ;
  condition = Lwt_condition.create () ;
}

let push q x =
  Queue.enqueue q.queue x ;
  Lwt_condition.signal q.condition ()

let rec pop q =
  match Queue.dequeue q.queue with
  | None ->
    Lwt_condition.wait q.condition >>= fun () ->
    pop q
  | Some x -> Lwt.return x
OCaml

Innovation. Community. Security.