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

29 commits

Author SHA1 Message Date
Nils
73d8424008 But cleanup 2021-07-28 11:50:15 +02:00
Nils
d1263aebd7 Removed non-STL components 2021-07-28 11:43:57 +02:00
Josh Baldwin
e9b225e42f
io_scheduler inline support (#79)
* io_scheduler inline support

* add debug info for io_scheduler size issue

* move poll info into its own file

* cleanup for feature

* Fix valgrind introduced use after free with inline processing

Running the coroutines inline with event processing caused
a use after free bug with valgrind detected in the inline
tcp server/client benchmark code.  Basically if an event
and a timeout occured in the same time period because the
inline processing would resume _inline_ with the event or the
timeout -- if the timeout and event occured in the same epoll_wait()
function call then the second one's coroutine stackframe would
already be destroyed upon resuming it so the poll_info->processed
check would be reading already free'ed memory.

The solution to this was to introduce a vector of coroutine handles
which are appended into on each epoll_wait() iteration of events
and timeouts, and only then after the events and timeouts are
deduplicated are the coroutine handles resumed.

This new vector has elided a malloc in the timeout function, but
there is still a malloc to extract the poll infos from the timeout
multimap data structure.  The vector is also on the class member
list and is only ever cleared, it is possible with a monster set
of timeouts that this vector could grow extremely large, but
I think that is worth the price of not re-allocating it.
2021-04-11 15:07:01 -06: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
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
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
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
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
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
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
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
0093173c55 rename engine to scheduler
rename schedule_task to resume_token
2020-09-26 23:35:33 -06:00
jbaldwin
2f575861dc engine works with normal coro::task<void> 2020-09-22 12:12:30 -06:00
jbaldwin
8cb23230e1 Added engine_task to properly delete completed root tasks
Added engine functions with tests
	poll()
	read()
	write()
	suspend()
	suspend_point()
	resume()
	shutdown()
2020-09-21 00:43:03 -06:00
jbaldwin
4aa248cd17 task<void> working, task co_await task working
Turns out that the final_suspend() method is required
to be std::suspend_always() otherwise the coroutine_handle<>.done()
function will not trigger properly.  Refactored the task class
to allow the user to decide if they want to suspend at the beginning
but it now forces a suspend at the end to guarantee that
task.is_ready() will work properly.
2020-09-08 22:44:38 -06:00
jbaldwin
fb04c43370 Template task suspends, prototype out engine thoughts 2020-09-07 23:29:03 -06:00
jbaldwin
bfe97a12b4 task and async_manual_reset_event 2020-09-07 18:21:40 -06:00