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
77
78
79
80
81
82
//! Task fetch modes for the thread pool.
//!
//! This module defines traits and structures that represent different task fetching strategies
//! used by the thread pool. These modes determine how tasks are fetched and scheduled
//! for execution, and whether they support task prioritization.
/// A trait representing a task fetching mode.
///
/// Implementations of this trait define how tasks are fetched from the task queues.
/// This trait is the base for more specific modes, such as priority and non-priority modes.
/// A marker trait for task fetching modes that do not support priorities.
///
/// Modes implementing this trait fetch tasks without considering their priorities.
/// A marker trait for task fetching modes that support task priorities.
///
/// Modes implementing this trait fetch tasks based on their priorities.
/// A task fetching mode using a global queue.
///
/// In this mode, all tasks are placed into a single global queue, and workers fetch
/// tasks directly from it without considering task priorities.
;
/// A task fetching mode using work stealing.
///
/// In this mode, each worker has its own local queue. Workers fetch tasks from their
/// local queues, and if a worker's queue is empty, it can steal tasks from other workers.
/// This mode does not consider task priorities.
;
/// A task fetching mode using a priority global queue.
///
/// In this mode, all tasks are placed into a single global queue that orders tasks
/// based on their priorities. Workers fetch the highest-priority tasks from the queue.
;
/// A task fetching mode using priority-based work stealing.
///
/// In this mode, each worker has its own local priority queue. Workers fetch tasks
/// based on priority from their local queues, and can steal tasks from other workers
/// if their own queues are empty.
;