The Pedigree Project 0.1
DeferredScope.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_DEFERREDSCOPE_H
9#define PEDIGREE_KERNEL_PROCESS_DEFERREDSCOPE_H
10#include "pedigree/kernel/processor/types.h"
11
12#include <config.h>
13
22 using Cleanup = void (*)(void*);
23
25 : next(nullptr),
26 stateLevel(0),
27 sequence(0),
28 defersTermination(false),
29 defersEvents(false),
30 cleanup(nullptr),
31 context(nullptr),
32 armed(false) {}
33
35 size_t stateLevel;
36 size_t sequence;
37 bool defersTermination;
38 bool defersEvents;
39 Cleanup cleanup;
40 void* context;
41 bool armed;
42
43 private:
44 friend class TerminationDeferral;
45 struct Uninitialised {};
46 // Pure deferral construction fills every field before publishing the record.
48};
49
50#endif