1
0
Fork 0
mirror of https://gitlab.com/niansa/libcrosscoro.git synced 2025-03-06 20:53:32 +01:00
Commit graph

17 commits

Author SHA1 Message Date
Josh Baldwin
8a64687510
coro::mutex (#35) 2021-01-16 20:27:11 -07:00
Josh Baldwin
bc3b956ed3
udp_peer! (#33)
* udp_peer!

I hope using the udp peer makes sense on how udp packets are
sent and received now.  Time will tell!

* Fix broken benchmark tcp server listening race condition
2021-01-09 19:18:03 -07:00
Josh Baldwin
92a42699bc
udp client + server (#31) 2021-01-08 20:28:55 -07:00
Josh Baldwin
f81acc9fcd
tcp client <-> server benchmarket (#29)
fixes #28
2020-12-31 17:24:11 -07:00
Josh Baldwin
6faafa0688
Refactor net and into cpp files (#25) 2020-12-31 13:53:13 -07:00
Josh Baldwin
ddd3c76c53
Rename scheduler to io_scheduler (#16)
Closes #15
2020-11-01 12:08:09 -07:00
Josh Baldwin
76b41a6ca0
Scheduler now correctly co_await's the user tasks from cleanup task (#14)
Previously it set the continuation manually, which sort of works but
is not canonical.
2020-10-28 17:35:23 -06:00
Josh Baldwin
2fb6624c48
thread_pool allow functors to be executed standalone (#12)
* thread_pool allow functors to be executed standalone

Closes #11

* Fix wakup issue for executors (whoops deleted a !)
2020-10-27 21:42:59 -06:00
Josh Baldwin
c548433dd9
Correctly implement sync_wait and when_all_awaitable (#8)
See issue for more details, in general attempting to
implement a coro::thread_pool exposed that the coro::sync_wait
and coro::when_all only worked if the coroutines executed on
that same thread.  They should now possibly have the ability
to execute on another thread, to be determined in a later issue.

Fixes #7
2020-10-25 20:54:19 -06:00
Josh Baldwin
303cc3384c
Issue 5/clang format (#6)
* clang-format all existing files

* Add detailed comments for event
2020-10-14 08:53:00 -06:00
jbaldwin
6c593cafad Enable -Wall and -Wextra
Renamed some scheduler internals, made scheduler
bench tests use std::memory_order_relaxed for counters.
2020-09-30 22:57:54 -06:00
jbaldwin
cbd1046161 Performance tuning
Lots of things tried including slabbing requests to reduce
allocations on schedule.  Turns out just not calling read/write
by setting an atomic flag if its already been trigger was
a major win.

Tuned all the atomic operations with std::memory_order*
to release/acquire or relaxed appropriately.

When processing items in the accept queue they are grabbed
now in 128 task chunks and processed inline.  This had a monster
speedup effect since the lock is significantly less contentious.

In all went from about 1.5mm ops/sec to 4mm ops/sec.

Good fun day.
2020-09-30 22:01:27 -06:00
jbaldwin
e0b8eb3f27 Added thread_strategy types for scheduler, fixed stackoverflow
The scheduler had a 'nice' optimization where any newly
submitted or resumed task would try and check if the current
thread its executing was the process event thread and if so
directly start or resume the task rather than pushing it into
the FIFO queues.  Well this has a bad side effect of a recursive
task which generates sub tasks will eventually cause a
stackoverflow to occur.  To avoid this the tasks for
submitting and resuming go through the normal FIFO queue which
is slower but removes the recursive function calls.
2020-09-28 23:20:56 -06:00
jbaldwin
40c84c1bf0 Move user resume token to scheduler func
This prevents the user from providing a resume token
to a yield function with another scheduler as its
internal pointer.
2020-09-28 19:39:48 -06:00
jbaldwin
7f3e4af71f Add scheduler_after
Attempted to test an accept task coroutine but
the performance was lacking, took a major hit
so scrapping that idea for now.  Currently
proccessing events inline on the background
thread epoll loop appears to be the most
efficient.
2020-09-28 18:52:06 -06:00
jbaldwin
fa374a4e95 adjust ops/sec in benchmark to be more realistic 2020-09-28 15:50:11 -06:00
jbaldwin
81d2ad3b3a Add benchmarks
Prioritize resumed tasks over new tasks.
Fixed issue with operator() called immediately
on lambdas causing them to go out of scope,
Debug builds didn't show a problem but Release did.
2020-09-28 00:29:40 -06:00