-
-
Notifications
You must be signed in to change notification settings - Fork 10
Using NeKernel: Ref, NonNullRef, and Leak()
Amlal El Mahrouss edited this page Mar 8, 2026
·
1 revision
In the NeKernel system, Ref<T> is a minimal value container for holding T instances without overhead, ideal for scheduler hot paths where copies kill perf.
-
Ref: Wraps a
Tby value (construct fromTor*T*via deref). Provides->and*for access; always truthy if constructed. -
Ref::Leak() / TryLeak(): Returns inner
T&for raw access/chaining (e.g.,ref.Leak()->Leak()). No RAII post-leak, caller owns the ref. Use for explicit escapes; assumes valid inner state.
Ref<USER_PROCESS> proc = FooBar(pid); // Wraps USER_PROCESS value
USER_PROCESS& raw = proc.Leak(); // Expose for manual use (e.g., Status = kRunning)NonNullRef<T>: Strict wrapper around Ref<T> rejects nulls at ctor via MUST_PASS.
Please read this: https://docs.kernel.org/process/coding-assistants.html
If it can't run on your machine, you can't PR it. Please actually test your code before submitting!
They will be closed after a week. Inactive PRs stalls everything.
Cheers. Amlal