The Pedigree Project 0.1
Classes | Public Types | Static Public Member Functions | Static Private Member Functions | List of all members
AdmittedThread Class Reference

#include <AdmittedThread.h>

+ Collaboration diagram for AdmittedThread:

Classes

struct  Context
 

Public Types

using Entry = int(*)(void *)
 
using Cancel = void(*)(void *)
 

Static Public Member Functions

static MUST_USE_RESULT bool launchDetached (Entry entry, void *parameter, Cancel cancel, OperationBarrier &barrier, const char *name=nullptr)
 

Static Private Member Functions

static void cancelBeforeStart (void *parameter)
 
static int trampoline (void *parameter)
 

Detailed Description

Runs module or subsystem work behind a kernel-resident admission boundary.

The worker is published as a detached Thread. Its entry point may live in unloadable module text, but the admission is released only after that entry point has returned to the kernel trampoline. On success ownership of parameter transfers to entry, or to cancel if the scheduler retires the worker before entry begins. On failure neither is called and the caller retains parameter. An explicit physical stack discard cannot return through the trampoline, so it intentionally leaks the admission and blocks teardown. The producer must itself be stopped or joined before the barrier is drained; admission protects entry and cancel, not the producer's module frame. A cancel callback runs on the scheduler's ordinary add worker and must not wait for new thread publication on that CPU or drain the same barrier whose admission it holds. A null cancel leaves parameter externally owned if entry never begins.

Definition at line 33 of file AdmittedThread.h.

Member Typedef Documentation

◆ Cancel

using AdmittedThread::Cancel = void (*)(void*)

Definition at line 36 of file AdmittedThread.h.

◆ Entry

using AdmittedThread::Entry = int (*)(void*)

Definition at line 35 of file AdmittedThread.h.

Member Function Documentation

◆ cancelBeforeStart()

void AdmittedThread::cancelBeforeStart ( void *  parameter)
staticprivate

Definition at line 84 of file AdmittedThread.cc.

◆ launchDetached()

bool AdmittedThread::launchDetached ( Entry  entry,
void *  parameter,
Cancel  cancel,
OperationBarrier barrier,
const char *  name = nullptr 
)
static

False means no Thread was published and the caller still owns parameter.

Definition at line 37 of file AdmittedThread.cc.

References Scheduler::instance(), panic(), Thread::startDetached(), and OperationBarrier::tryAcquire().

◆ trampoline()

int AdmittedThread::trampoline ( void *  parameter)
staticprivate

Definition at line 92 of file AdmittedThread.cc.


The documentation for this class was generated from the following files: