Zth (libzth)
worker.h File Reference
#include <libzth/allocator.h>
#include <libzth/config.h>
#include <libzth/context.h>
#include <libzth/fiber.h>
#include <libzth/init.h>
#include <libzth/list.h>
#include <libzth/perf.h>
#include <libzth/waiter.h>
#include <cstring>
#include <limits>
#include <time.h>

Go to the source code of this file.

Classes

class  zth::Worker
 The class that manages the fibers within this thread. More...
 

Namespaces

 zth
 

Functions

void zth::sigchld_check ()
 
Worker & zth::currentWorker () noexcept
 Return the (thread-local) singleton Worker instance. More...
 
Fiber & zth::currentFiber () noexcept
 Return the currently executing fiber. More...
 
UniqueID< Fiber > const & zth::currentFiberID () noexcept
 
void zth::getContext (Worker **worker, Fiber **fiber) noexcept
 
void zth::yield (Fiber *preferFiber=nullptr, bool alwaysYield=false, Timestamp const &now=Timestamp::now())
 Allow a context switch. More...
 
void zth::outOfWork ()
 Force a context switch. More...
 
void zth::suspend ()
 
void zth::resume (Fiber &fiber)
 
int zth::startWorkerThread (void(*f)(), size_t stack, char const *name)
 Start a new thread, create a Worker, with one fiber, which executes f. More...
 
int zth::execlp (char const *file, char const *arg,...)
 Start an external program. More...
 
int zth::execvp (char const *file, char *const arg[])
 Start an external program. More...
 
void zth_yield () noexcept
 Allow a context switch. More...
 
void zth_outOfWork () noexcept
 Force a context switch. More...
 
int zth_worker_create () noexcept
 Create a Worker. More...
 
void zth_worker_run (struct timespec const *ts=nullptr) noexcept
 Run the worker for the given amount of time. More...
 
void zth_worker_destroy () noexcept
 Cleanup the worker. More...
 
int zth_startWorkerThread (void(*f)(), size_t stack=0, char const *name=nullptr) noexcept
 Start a new thread, create a Worker, with one fiber, which executes f. More...
 
int zth_execvp (char const *file, char *const arg[]) noexcept
 Start an external program. More...