@@ -12,6 +12,7 @@ use crate::utils::{
1212 Init , PrioBitmap ,
1313} ;
1414
15+ #[ cfg_attr( doc, svgbobdoc:: transform) ]
1516/// Represents a single task in a system.
1617///
1718/// This type is ABI-compatible with [`Id`].
@@ -25,15 +26,43 @@ use crate::utils::{
2526///
2627/// A task may be in one of the following states:
2728///
28- /// - **Dormant**
29- /// - **Ready**
30- /// - **Running**
31- /// - **Waiting**
29+ /// - **Dormant** — The task is not executing, doesn't have an associated
30+ /// execution [thread], and can be [activated].
3231///
33- #[ doc( include = "../common.md" ) ]
32+ /// - **Ready** — The task has an associated execution thread, which is ready to
33+ /// be scheduled to the CPU
34+ ///
35+ /// - **Running** — The task has an associated execution thread, which is
36+ /// currently scheduled to the CPU
37+ ///
38+ /// - **Waiting** — The task has an associated execution thread, which is
39+ /// currently blocked by a blocking operation
40+ ///
41+ /// ```svgbob
42+ /// ,-------,
43+ /// ,--------------->| Ready |<--------------,
44+ /// | '-------' |
45+ /// | dispatch | ^ |
46+ /// | | | |
47+ /// | release | | | activate
48+ /// ,---------, | | ,---------,
49+ /// | Waiting | | | | Dormant |
50+ /// '---------' | | '---------'
51+ /// ^ | | ^
52+ /// | | | |
53+ /// | v | preempt |
54+ /// | wait ,---------, |
55+ /// '---------------| Running |--------------'
56+ /// '---------' exit
57+ /// ```
58+ ///
59+ /// [thread]: crate#threads
60+ /// [activated]: Task::activate
3461#[ repr( transparent) ]
3562pub struct Task < System > ( Id , PhantomData < System > ) ;
3663
64+ // FIXME: `svgbobdoc` doesn't like `#[doc(include = ...)]`
65+ #[ doc( include = "../common.md" ) ]
3766impl < System > Clone for Task < System > {
3867 fn clone ( & self ) -> Self {
3968 Self ( self . 0 , self . 1 )
0 commit comments