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

59 commits

Author SHA1 Message Date
Josh Baldwin
6220b61c68
coro::mutex uses function for unlocked state to reduce memory (#77) 2021-03-07 13:39:03 -07:00
Josh Baldwin
8ecd35af40
Backport bugs found from issue-72 (lockless thread_pool queue) (#75) 2021-03-07 11:08:31 -07:00
Josh Baldwin
19d626c1fb
coro::mutex remove std::mutex requirement, only 1 atomic with CAS (#71) 2021-02-27 14:46:37 -07:00
Josh Baldwin
fab634154f
Update README with section links (#70)
* Update README with section links

* add # to links

* try event instead of coro::event

* Update section names to remove "::" since markdown doesn't seem to link
properly with them
2021-02-27 12:33:42 -07:00
Josh Baldwin
078d18f7fe
coro::shared_mutex (#67) 2021-02-27 12:04:49 -07:00
Josh Baldwin
c1acf8b80d
coro::semaphore (#65)
* coro::semaphore

* coro::ring_buffer<E, N>
2021-02-23 11:05:21 -07:00
Josh Baldwin
6a2f398f9a
coro::when_all() always takes ownership (#63) 2021-02-17 10:50:51 -07:00
Josh Baldwin
4aee0dc6f8
coro::task_container example (#58) 2021-02-15 20:17:11 -07:00
Josh Baldwin
60a74af219
io_scheduler example (#57) 2021-02-15 18:52:45 -07:00
Josh Baldwin
017a4e2621
coro::when_all(tuple) use after free fix (#56) 2021-02-15 17:18:20 -07:00
Josh Baldwin
e1e52b1400
Add SSL/TLS support for TCP client/server via OpenSSL (#54)
* Add SSL/TLS support for TCP client/server via OpenSSL

* Comments addressed
2021-02-15 14:01:48 -07:00
Josh Baldwin
730928e8b5
Add coro::thread_pool example (#52) 2021-01-31 18:05:01 -07:00
Josh Baldwin
5ad45c3848
Add coro::task<T> example (#48)
* Add coro::task<T> example

* remove std::move on return statement in task example
2021-01-31 13:56:48 -07:00
Josh Baldwin
cb335b4474
Add coro::generator<T> example (#46) 2021-01-31 13:05:37 -07:00
Josh Baldwin
60994334fe
Add coro::mutex example to readme (#45)
* Add coro::mutex example to readme

* explicit lock_operation ctor

* lock_operation await_ready() uses try_lock

This allows for the lock operation to skip await_suspend() entirely
if the lock was unlocked.
2021-01-30 16:09:31 -07:00
Josh Baldwin
80fea9c49a
io_scheduler uses thread pool to schedule work (#42)
* io_scheduler uses thread pool to schedule work

fixes #41

* use task_container in bench tcp server test

* adjust benchmark for github actions CI

* fix io_scheduler tests cross thread memory boundaries

* more memory barriers

* sprinkle some shutdowns in there

* update readme
2021-01-24 19:34:39 -07:00
Josh Baldwin
95127e2f6e
Add coro::latch example (#40) 2021-01-17 11:38:14 -07:00
Josh Baldwin
03f78e2360
codacy and lgtm analysis (#37) 2021-01-16 20:51:37 -07:00
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
290cb85aca
rename tcp_scheduler to tcp_server (#27) 2020-12-31 14:42:26 -07:00
Josh Baldwin
6faafa0688
Refactor net and into cpp files (#25) 2020-12-31 13:53:13 -07:00
Josh Baldwin
c02aefe26e
libc-ares dns client for hostname -> ip addres lookups (#24)
* libc-ares dns client for hostname -> ip addres lookups

* Add tcp_client dns lookup if hostname + dns available
2020-12-29 17:19:26 -07:00
Josh Baldwin
e11058ef22
tcp_client (#22)
* tcp_client

fixes #21

* remove double ci build
2020-12-27 14:32:03 -07:00
Josh Baldwin
b15c7c1d16
io_scheduler support timeouts (#20)
* io_scheduler support timeouts

Closes #19

* io_scheduler resume_token<poll_status> for poll()

* io_scheduler read/write now use poll_status + size return
2020-11-11 23:06:42 -07:00
Josh Baldwin
1c7b340c72
add tcp_scheduler (#18)
Closes #17
2020-11-01 18:46:41 -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
33df116b40
Add coro::thread_pool (#10)
Closes #9
2020-10-26 11:51:24 -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
Josh Baldwin
1a2ec073ca
Add tests for tasks that throw (#4)
* Add tests for tasks that throw

* Additional task types for throwing coverage
2020-10-12 17:29:47 -06:00
Josh Baldwin
31dded8611
Add CI & code coverage (#2)
* Add CI & code coverage

* Remove un-used -lzmq dependency

* Update readme with coverage/background/goals
2020-10-11 18:23:05 -06:00
jbaldwin
c820498f50 Add coro::generator<T> 2020-10-11 11:42:12 -07:00
jbaldwin
771e52e985 addd latch, renamed "amre" to event
Remove the event return type, this should just be a task<T>
2020-10-03 16:29:30 -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
jbaldwin
fdfcb0fe62 Create dedicated task manager for scheduler task lifetime management 2020-09-27 18:51:15 -06:00
jbaldwin
cf9bce1d97 split scheduler + resume file descriptors 2020-09-27 14:33:38 -06:00
jbaldwin
7e4e37e1c2 scheduler now owns tasks that are submitted 2020-09-27 14:20:30 -06:00
jbaldwin
0093173c55 rename engine to scheduler
rename schedule_task to resume_token
2020-09-26 23:35:33 -06:00
jbaldwin
6d5c3be6c3 Force engine_event.set() to resume coroutines 2020-09-26 14:05:29 -06:00