Clean up some iothreads

Improve the iothread behavior by enabling an iothread to stick around for
a while waiting for work. This reduces the amount of iothread churn, which
is useful on platforms where threads are expensive.

Also do other modernization like clean up the locking discipline and use
FLOG.
This commit is contained in:
ridiculousfish
2019-11-23 13:37:15 -08:00
parent a74fc7ef6d
commit 9d7d70c204
3 changed files with 125 additions and 59 deletions

View File

@@ -27,7 +27,8 @@ int iothread_port(void);
void iothread_service_completion(void);
/// Waits for all iothreads to terminate.
void iothread_drain_all(void);
/// \return the number of threads that were running.
int iothread_drain_all(void);
// Internal implementation
int iothread_perform_impl(std::function<void(void)> &&func, std::function<void(void)> &&completion);