Commit graph

33 commits

Author SHA1 Message Date
Simon Cruanes
d15bfb07f2
fix pool: rework scheduler to use one condition 2023-10-24 13:47:53 -04:00
Simon Cruanes
69faea0bcb
wip: have only one condition in pool 2023-10-24 12:53:19 -04:00
Simon Cruanes
faeb95b49d
fix pool: on shutdown, finish reading from all queues 2023-10-24 09:53:18 -04:00
Simon Cruanes
18d5bad2a9
domain pool: let domains live a bit longer
this is an optimization to ensure we don't stop/start domains too often,
which harms performance really badly.
2023-08-13 22:48:04 -04:00
Simon Cruanes
ed531e68e1
fix: race condition in shutdown, we need to wait for domain to quit
risk is a tight loop of `Pool.with_`, where by not waiting for the pool
to entirely shutdown (including the domains, potentially) we risk
running out of domains in the next iterations.
2023-08-13 22:24:18 -04:00
Simon Cruanes
9db0a9fe28
full lifecycle for worker domains
domains can now stop when all worker threads running on them are done
2023-08-12 14:09:35 -04:00
Simon Cruanes
5680938a6c
fix: generalize type of create_arg 2023-08-01 12:34:13 -04:00
Simon Cruanes
858755e812
feat: add Pool.with_ 2023-07-10 01:14:07 -04:00
Simon Cruanes
427c462778
compat 4.x 2023-07-09 22:05:42 -04:00
Simon Cruanes
1d57ae8fbb
remove dead code 2023-07-09 19:49:26 -04:00
Simon Cruanes
76ca0f2d88
feat: add Runner, change Pool to produce a Runner.t
futures, chans, etc. should use the `Runner.t` abstraction
and not depend on the exact pool implementation to run tasks.

For now `Pool.create` is the only implementation of a runner, but now
it's possible to implement alternatives.
2023-07-09 19:49:25 -04:00
Simon Cruanes
b07d460b3f
port cpp.ml from containers, replace previous codegen with it
now OCaml 5-only features are truly available only on OCaml 5, instead
of just relying on the user reading the docstring.
2023-07-09 19:49:24 -04:00
Simon Cruanes
2acf4b28eb feat: actually support domain-local-await if installed 2023-07-05 22:19:18 -04:00
Simon Cruanes
45838d9607 fix: in fork-join, start sub-tasks within a handler 2023-07-05 21:55:00 -04:00
Simon Cruanes
309424a58f move fork join into its own module 2023-07-05 21:55:00 -04:00
Simon Cruanes
009855ce0d feat: add Pool.fork_join 2023-07-05 21:55:00 -04:00
Simon Cruanes
9f04d254af
feat: Pool.run_wait_block can return a value now 2023-06-24 15:06:40 -04:00
Simon Cruanes
ab718b22f9
add Pool.run_wait_block; rename Pool.run into Pool.run_async 2023-06-24 14:50:43 -04:00
Simon Cruanes
1d23d2d7a1
rename Fut.await_exn to Fut.await 2023-06-20 22:43:33 -04:00
Simon Cruanes
4fd6154b56
refactor suspend
do not wrap each step in a new handler; using Effects.Deep we only wrap
the entrypoint of the task, and subsequent `continue` get scheduled
as-is.
2023-06-20 22:43:15 -04:00
Simon Cruanes
e26029ab90
feat: add Fut.await and Fut.await_exn for OCaml >= 5.0
this uses suspension (based on `Suspend_`) to wait for completion of the
future.
2023-06-20 22:43:13 -04:00
Simon Cruanes
fc3d2d2645
add around_task to Pool.create 2023-06-15 11:23:55 -04:00
Simon Cruanes
b451fde853
add Pool.shutdown_without_waiting 2023-06-15 10:52:17 -04:00
Simon Cruanes
059ee8a1d5
add Pool.num_tasks 2023-06-15 10:35:41 -04:00
Simon Cruanes
483392986c
perf: limit number of work queues in pool 2023-06-14 11:21:11 -04:00
Simon Cruanes
82af5497f8
pool: do some spinning in run, not in workers 2023-06-13 13:52:22 -04:00
Simon Cruanes
939c6e117c
perf: a few retries in the pool 2023-06-13 13:52:22 -04:00
Simon Cruanes
bde69ba33f
perf: use multiple queues and non-blocking work stealing from them 2023-06-13 13:52:22 -04:00
Simon Cruanes
d2521472c0
refactor: rename little blocking queue 2023-06-08 14:22:35 -04:00
Simon Cruanes
0b70060c40
perf pool: use relax() in spin loop 2023-06-08 00:19:24 -04:00
Simon Cruanes
adfa1e62cb
fix(pool): make sure the work queue is closed properly
this way we can't submit new jobs after the pool has been shutdown.
2023-06-05 13:04:10 -04:00
Simon Cruanes
6ffbd15a34
add Pool.size 2023-06-02 12:05:39 -04:00
Simon Cruanes
d87dff529d
split into multiple files 2023-06-01 22:04:06 -04:00