mirror of
https://github.com/c-cube/tiny_httpd.git
synced 2025-12-06 11:15:35 -05:00
.mli and .opam
This commit is contained in:
parent
210aab466b
commit
b8dbf397b7
3 changed files with 40 additions and 2 deletions
|
|
@ -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)
|
||||
|
|
|
|||
21
src/domains/Tiny_httpd_domains.mli
Normal file
21
src/domains/Tiny_httpd_domains.mli
Normal 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
|
||||
|
|
@ -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}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue