completion.rs 660 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
// SPDX-License-Identifier: Apache-2.0

use std::sync::Arc;

use crate::status::EventPoison;

pub(crate) type PoisonArc = Arc<EventPoison>;

#[derive(Clone, Debug)]
pub(crate) enum CompletionKind {
    Triggered,
    Poisoned(PoisonArc),
}

impl CompletionKind {
    pub(crate) fn as_result(&self) -> Result<(), EventPoison> {
        match self {
            Self::Triggered => Ok(()),
            Self::Poisoned(poison) => Err((**poison).clone()),
        }
    }
}

pub(crate) enum WaitRegistration {
    Ready,
    Pending,
    Poisoned(PoisonArc),
}