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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/*******************************************************************************
*
* Copyright (c) 2025 - 2026 Haixing Hu.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0.
*
******************************************************************************/
use ;
use TaskSlot;
/// Shared runner-side task slot used by service stop and task execution paths.
pub type SharedTaskSlot<R, E> = ;
/// Wraps a task slot in shared optional storage.
///
/// # Parameters
///
/// * `slot` - Runner-side completion endpoint for an accepted task.
///
/// # Returns
///
/// A shared optional slot that can be taken by either the runner path or the
/// queued-cancellation path.
/// Takes the task slot from shared storage while tolerating poisoned locks.
///
/// # Parameters
///
/// * `slot` - Shared optional task slot.
///
/// # Returns
///
/// `Some(TaskSlot)` if this call won the slot ownership race, otherwise `None`.
/// Cancels an unstarted task slot if queued service accounting is still active.
///
/// The queued-accounting callback is consulted before the slot is taken. This
/// prevents a late stop request from cancelling the result slot after service
/// accounting has already moved the task to running.
///
/// # Parameters
///
/// * `slot` - Shared optional task slot to cancel.
/// * `finish_queued` - Callback that finishes queued service accounting.
///
/// # Returns
///
/// `true` if queued service accounting was completed by this call.