Compare commits

..

3 commits

Author SHA1 Message Date
Simon Cruanes
870093e93a
prepare for 0.1
Some checks are pending
github pages / Deploy doc (push) Waiting to run
Build and Test / build (push) Waiting to run
Build and Test / format (push) Waiting to run
2025-05-07 09:54:54 -04:00
Simon Cruanes
066604538f
chore: dune-project 2025-05-07 09:53:57 -04:00
Simon Cruanes
9b2107ec7c
update example 2025-05-07 09:52:36 -04:00
7 changed files with 27 additions and 21 deletions

3
CHANGES.md Normal file
View file

@ -0,0 +1,3 @@
# 0.1
initial release, with poll and select backends.

View file

@ -1,16 +1,11 @@
(lang dune 2.7)
(name nanoev)
(generate_opam_files true)
(source
(github c-cube/nanoev))
(authors "Simon Cruanes")
(maintainers "Simon Cruanes")
(version 0.1)
(license MIT)
;(documentation https://url/to/documentation)

View file

@ -15,25 +15,26 @@ let main () : unit =
let n_tasks_done = Atomic.make 0 in
let n_sent = Atomic.make 0 in
let n_recv = Atomic.make 0 in
ignore
(Thread.create
(fun () ->
while true do
Printf.printf "%stasks done: %d sent: %d recv: %d%!" reset_line
(Atomic.get n_tasks_done) (Atomic.get n_sent) (Atomic.get n_recv);
Trace.counter_int "task-done" (Atomic.get n_tasks_done);
Trace.counter_int "sent" (Atomic.get n_sent);
Trace.counter_int "recv" (Atomic.get n_recv);
Thread.delay 0.2
done)
()
: Thread.t);
let remoteaddr = Unix.ADDR_INET (Unix.inet_addr_loopback, !port) in
(let@ pool = Moonpool.Ws_pool.with_ ~num_threads:!j () in
let remoteaddr = Unix.ADDR_INET (Unix.inet_addr_loopback, !port) in
ignore
(Thread.create
(fun () ->
while true do
Printf.printf "%stasks done: %d sent: %d recv: %d%!" reset_line
(Atomic.get n_tasks_done) (Atomic.get n_sent) (Atomic.get n_recv);
Trace.counter_int "task-done" (Atomic.get n_tasks_done);
Trace.counter_int "sent" (Atomic.get n_sent);
Trace.counter_int "recv" (Atomic.get n_recv);
Thread.delay 0.2
done)
()
: Thread.t);
let task () =
let[@alert "-deprecated"] _sp =
@ -64,6 +65,9 @@ let main () : unit =
done
in
if Random.float 1. > 0.992 then
Trace.counter_int "n-tasks" (Moonpool.Runner.num_tasks pool);
Picos.Fiber.(yield ());
(* receive a response *)

View file

@ -1,5 +1,6 @@
# This file is generated by dune, edit dune-project instead
opam-version: "2.0"
version: "0.1"
synopsis: "Use nanoev from picos"
maintainer: ["Simon Cruanes"]
authors: ["Simon Cruanes"]

View file

@ -1,5 +1,6 @@
# This file is generated by dune, edit dune-project instead
opam-version: "2.0"
version: "0.1"
synopsis: "Use mtime+iomux (posix compliant) as a backend for nanoev"
maintainer: ["Simon Cruanes"]
authors: ["Simon Cruanes"]

View file

@ -1,5 +1,6 @@
# This file is generated by dune, edit dune-project instead
opam-version: "2.0"
version: "0.1"
synopsis: "Tiny event loop abstraction"
maintainer: ["Simon Cruanes"]
authors: ["Simon Cruanes"]

View file

@ -1,5 +1,6 @@
# This file is generated by dune, edit dune-project instead
opam-version: "2.0"
version: "0.1"
synopsis: "Use nanoev as a basis for tiny_httpd"
maintainer: ["Simon Cruanes"]
authors: ["Simon Cruanes"]