Skip to content
Snippets Groups Projects

Wakeup worker per eventfd

Closed Florian Fischer requested to merge aj46ezos/emper:wakeup_worker_per_eventfd into master
Files
4
+ 8
2
@@ -3,6 +3,7 @@
#include "Runtime.hpp"
#include <pthread.h> // for pthread_t, pthread_attr_init
#include <sys/eventfd.h>
#include <cerrno> // for errno
// Non portable.
@@ -72,8 +73,7 @@ Runtime::Runtime(workerid_t workerCount, RuntimeStrategyFactory& strategyFactory
threads(new pthread_t[workerCount]),
workers(new Worker*[workerCount]),
randomEngine(seed),
sleepingWorkers(0),
skipSleep(false) {
sleepingWorkers(0) {
const int nprocs = get_nprocs();
{
@@ -84,6 +84,12 @@ Runtime::Runtime(workerid_t workerCount, RuntimeStrategyFactory& strategyFactory
currentRuntime = this;
}
// initialize the wakeup eventfd
wakeup_fd = eventfd(0, EFD_SEMAPHORE);
if (wakeup_fd == -1) {
DIE_MSG_ERRNO("creating wakeup eventfd failed");
}
// initialize the global and all worker IoContexts
if constexpr (emper::IO) {
// The global io_uring needs at least workerCount entries in its SQ because
Loading