.mli and .opam

This commit is contained in:
craff 2022-12-06 16:57:37 -10:00
parent 210aab466b
commit b8dbf397b7
3 changed files with 40 additions and 2 deletions

View file

@ -1,4 +1,21 @@
(** {1 Tiny Http With OCaml's domain}
This module allows for using OCaml 5 domains instead of system thread.
This enable sharing memory between task serving requests, for instance
for caching answers.
Here is how to use:
{[
let pool = Domainslib.Task.setup_pool ~num_domains:4 () in
let new_thread = Tiny_httpd_domains.new_thread pool in
let server = Tiny_httpd.create ~new_thread ()
....
match Tiny_httpd_domains.run pool server with
| Ok () -> ()
| Error e -> raise e
*)
let new_thread pool f =
ignore (Domainslib.Task.async pool f)

View file

@ -0,0 +1,21 @@
(** {1 Tiny Http With OCaml's domain}
This module allows for using OCaml 5 domains instead of system thread.
This enable sharing memory between task serving requests, for instance
for caching answers.
Here is how to use:
{[
let pool = Domainslib.Task.setup_pool ~num_domains:4 () in
let new_thread = Tiny_httpd_domains.new_thread pool in
let server = Tiny_httpd.create ~new_thread ()
....
match Tiny_httpd_domains.run pool server with
| Ok () -> ()
| Error e -> raise e
*)
val new_thread : Domainslib.Task.pool -> 'a Domainslib.Task.task -> unit
val run : Domainslib.Task.pool -> Tiny_httpd_server.t -> (unit, exn) result

View file

@ -1,9 +1,9 @@
opam-version: "2.0"
version: "0.12"
authors: ["Christophe Raffalli"]
maintainer: "simon.cruanes.2007@m4x.org"
maintainer: "christophe@raffalli.eu"
license: "MIT"
synopsis: "Interface to camlzip for tiny_httpd"
synopsis: "Using OCaml 5 domains instead of thread"
build: [
["dune" "build" "@install" "-p" name "-j" jobs]
["dune" "build" "@doc" "-p" name] {with-doc}