Zth (libzth)
context.h File Reference

Context switch mechanism implementation. More...

#include "libzth/macros.h"
#include "libzth/util.h"
#include "libzth/allocator.h"
#include "libzth/context.h"
#include "libzth/worker.h"
#include <setjmp.h>
#include <unistd.h>
#include <signal.h>
#include <sys/mman.h>
#include "libzth/context/arch_generic.h"
#include "libzth/context/ucontext.h"

Go to the source code of this file.

Classes

class  zth::impl::ContextBase< Impl >
 Base class of the Context. More...
 
struct  zth::impl::ContextBase< Impl >::Stack
 Stack information. More...
 

Namespaces

 zth
 
 zth::impl
 

Macros

#define MAP_STACK   0
 

Functions

void context_entry (zth::Context *context) noexcept
 Entry point of the fiber. More...
 

Detailed Description

Context switch mechanism implementation.

This file is a private header file, only used by src/context.cpp. Do not include it otherwise.

Definition in file context.h.

Macro Definition Documentation

◆ MAP_STACK

#define MAP_STACK   0

Definition at line 39 of file context.h.

Function Documentation

◆ context_entry()

void context_entry ( zth::Context context)
noexcept

Entry point of the fiber.

This function is called by the actual context switching mechanism. It will call the entry function, as specified by the Context's attributes during creation, which is zth::Fiber::fiberEntry() by default.

This function does not return. When the entry function returns, the context is considered dead, the Worker's scheduler is invoked, and the context is destroyed.

Definition at line 178 of file context.cpp.