The Pedigree Project 0.1
AdmittedThread.h
1/*
2 * Copyright (c) 2026, Pedigree Developers
3 *
4 * Permission to use, copy, modify, and distribute this software for any
5 * purpose with or without fee is hereby granted.
6 */
7
8#ifndef PEDIGREE_KERNEL_PROCESS_ADMITTEDTHREAD_H
9#define PEDIGREE_KERNEL_PROCESS_ADMITTEDTHREAD_H
10#include "pedigree/kernel/compiler.h"
11
12#include <config.h>
13
15
33class EXPORTED_PUBLIC AdmittedThread {
34 public:
35 using Entry = int (*)(void*);
36 using Cancel = void (*)(void*);
37
39 MUST_USE_RESULT static bool launchDetached(Entry entry, void* parameter, Cancel cancel,
40 OperationBarrier& barrier, const char* name = nullptr);
41
42#if (HOSTED && PEDIGREE_HOSTED_SMOKE_TESTS) || PEDIGREE_CONCURRENCY_SMOKE_TESTS
43 using BeforeStartHook = void (*)(class Thread* thread, void* context);
44 static void setBeforeStartHookForTest(BeforeStartHook hook, void* context);
45#endif
46
47 private:
48 struct Context;
49
50 static void cancelBeforeStart(void* parameter);
51 static int trampoline(void* parameter);
52};
53
54#endif