1
0
Fork 0
mirror of https://gitlab.com/niansa/libcrosscoro.git synced 2025-03-06 20:53:32 +01:00
libcrosscoro/inc/coro
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
..
concepts io_scheduler inline support (#79) 2021-04-11 15:07:01 -06:00
detail io_scheduler inline support (#79) 2021-04-11 15:07:01 -06:00
net io_scheduler inline support (#79) 2021-04-11 15:07:01 -06:00
coro.hpp io_scheduler inline support (#79) 2021-04-11 15:07:01 -06:00
event.hpp io_scheduler inline support (#79) 2021-04-11 15:07:01 -06:00
fd.hpp io_scheduler inline support (#79) 2021-04-11 15:07:01 -06:00
generator.hpp Issue 5/clang format (#6) 2020-10-14 08:53:00 -06:00
io_scheduler.hpp io_scheduler inline support (#79) 2021-04-11 15:07:01 -06:00
latch.hpp Add coro::mutex example to readme (#45) 2021-01-30 16:09:31 -07:00
mutex.hpp coro::mutex uses function for unlocked state to reduce memory (#77) 2021-03-07 13:39:03 -07:00
poll.hpp libc-ares dns client for hostname -> ip addres lookups (#24) 2020-12-29 17:19:26 -07:00
ring_buffer.hpp Update README with section links (#70) 2021-02-27 12:33:42 -07:00
semaphore.hpp Backport bugs found from issue-72 (lockless thread_pool queue) (#75) 2021-03-07 11:08:31 -07:00
shared_mutex.hpp io_scheduler inline support (#79) 2021-04-11 15:07:01 -06:00
stop_signal.hpp coro::semaphore (#65) 2021-02-23 11:05:21 -07:00
sync_wait.hpp Add coro::mutex example to readme (#45) 2021-01-30 16:09:31 -07:00
task.hpp coro::mutex (#35) 2021-01-16 20:27:11 -07:00
task_container.hpp io_scheduler inline support (#79) 2021-04-11 15:07:01 -06:00
thread_pool.hpp io_scheduler inline support (#79) 2021-04-11 15:07:01 -06:00
when_all.hpp coro::when_all() always takes ownership (#63) 2021-02-17 10:50:51 -07:00