pub struct ProductProcessExitState {
pub last_status: Option<Status>,
pub exit_count: u32,
pub process: *mut Process,
pub release_on_exit: bool,
pub kind: ProcessExitKind,
pub hook_ctx: *mut (),
pub hook: Option<unsafe fn(*mut (), &mut Process, Status, &rusage)>,
}Expand description
Thin exit-handler state shared by all product residual ProcessExit variants.
Process::on_exit already writes process.status and calls detach()
(poll close + clear handler) before dispatching here. This owner still:
- Mirrors status onto the owner (writeback for callers that only hold us)
- Clears / optionally unrefs its process backref (safe unref/poll cleanup)
- Fires an optional hook + debug log (observability)
Note: not Debug — Status is not Debug (owns bun_sys::Error paths).
Fields§
§last_status: Option<Status>Last status observed by on_process_exit.
exit_count: u32How many times on_process_exit has run.
process: *mut ProcessOptional intrusive *mut Process the domain owner attached.
release_on_exit: boolWhen true, on_process_exit will Process::deref the matching backref
after clearing it (domain took a strong ref via attach_process).
kind: ProcessExitKindClosed-set kind (for logs / debug).
hook_ctx: *mut ()Optional user hook context.
hook: Option<unsafe fn(*mut (), &mut Process, Status, &rusage)>Optional user hook.
Implementations§
Source§impl ProductProcessExitState
impl ProductProcessExitState
pub fn new(kind: ProcessExitKind) -> ProductProcessExitState
Sourcepub fn attach_process(&mut self, process: *mut Process, take_ref: bool)
pub fn attach_process(&mut self, process: *mut Process, take_ref: bool)
Attach a process backref. When take_ref is true, the owner holds a
strong ref released on exit (caller must have already ref_’d).
Sourcepub fn set_hook(
&mut self,
ctx: *mut (),
hook: Option<unsafe fn(*mut (), &mut Process, Status, &rusage)>,
)
pub fn set_hook( &mut self, ctx: *mut (), hook: Option<unsafe fn(*mut (), &mut Process, Status, &rusage)>, )
Install an optional observability / finish hook.
Sourcepub unsafe fn on_process_exit(
&mut self,
process: &mut Process,
status: Status,
rusage: &rusage,
)
pub unsafe fn on_process_exit( &mut self, process: &mut Process, status: Status, rusage: &rusage, )
Core exit body — non-empty: status writeback, safe cleanup, log + hook.
# Safety
process is the live &mut Process from Process::on_exit /
ProcessExitHandler dispatch. Must not be freed before this returns.
Auto Trait Implementations§
impl !RefUnwindSafe for ProductProcessExitState
impl !Send for ProductProcessExitState
impl !Sync for ProductProcessExitState
impl !UnwindSafe for ProductProcessExitState
impl Freeze for ProductProcessExitState
impl Unpin for ProductProcessExitState
impl UnsafeUnpin for ProductProcessExitState
Blanket Implementations§
Source§impl<T> AsCtxPtr for Twhere
T: ?Sized,
impl<T> AsCtxPtr for Twhere
T: ?Sized,
Source§fn as_ctx_ptr(&self) -> *mut Selfwhere
Self: Sized,
fn as_ctx_ptr(&self) -> *mut Selfwhere
Self: Sized,
self’s address as *mut Self for deferred-task / scopeguard /
ref_guard ctx slots. The closures/trampolines deref it as shared
(&*p) — every method they reach is &self post-R-2, so no write
provenance is required; the *mut spelling is purely to match the
existing DerefOnDrop / HasAutoFlush / RefCount ABI.Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> ErasedDestructor for Twhere
T: 'static,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Filterable for T
impl<T> Filterable for T
Source§fn filterable(
self,
filter_name: &'static str,
) -> RequestFilterDataProvider<T, fn(DataRequest<'_>) -> bool>
fn filterable( self, filter_name: &'static str, ) -> RequestFilterDataProvider<T, fn(DataRequest<'_>) -> bool>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more