mirror of
https://github.com/c-cube/nanoev.git
synced 2025-12-06 03:05:32 -05:00
Compare commits
3 commits
604224d1cf
...
870093e93a
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
870093e93a | ||
|
|
066604538f | ||
|
|
9b2107ec7c |
7 changed files with 27 additions and 21 deletions
3
CHANGES.md
Normal file
3
CHANGES.md
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
# 0.1
|
||||
|
||||
initial release, with poll and select backends.
|
||||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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 *)
|
||||
|
|
|
|||
|
|
@ -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"]
|
||||
|
|
|
|||
|
|
@ -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"]
|
||||
|
|
|
|||
|
|
@ -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"]
|
||||
|
|
|
|||
|
|
@ -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"]
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue