Skip to content

Commit d76a716

Browse files
committed
thread: add basic intro blurb
1 parent b214d49 commit d76a716

4 files changed

Lines changed: 23 additions & 15 deletions

File tree

docs/groups.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
@brief Interrupt handling
4646
*/
4747
/*! @defgroup thread Threads
48-
@brief Thread management @see @ref thrd_intro
48+
@brief Thread management
4949
*/
5050
/*! @defgroup sync Sync
5151
@brief Synchronization primitives
@@ -57,7 +57,7 @@
5757
//! @}
5858

5959
/*! @defgroup hw Hardware
60-
@brief Low-level device wrappers
60+
@brief Low-level system devices
6161
@{
6262
*/
6363

@@ -79,7 +79,7 @@
7979
//! @}
8080

8181
/*! @defgroup dev Devices
82-
@brief High-level device drivers
82+
@brief Device drivers and associated APIs
8383
@{
8484
*/
8585

docs/pages.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
#pragma once
22

3-
/*! @page thrd_intro Threading
4-
@brief General overview of calico's threading system
5-
@include{doc} "threads.md"
6-
*/
73
/*! @page license License
84
@brief Licensing information about calico
95
@include{doc} "../COPYING"

docs/threads.md

Lines changed: 0 additions & 4 deletions
This file was deleted.

include/calico/system/thread.h

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,22 @@
55
#include "tick.h"
66

77
/*! @addtogroup thread
8+
9+
Calico provides a simple preemptive multithreading system. Each thread is
10+
assigned a priority level and has its own execution state, allowing software
11+
to be better structured by having different processing tasks each in its own
12+
thread. Threads may wait on events such as interrupts. Calico ensures at all
13+
times that the currently running thread is always the highest priority thread
14+
that can run. If any event occurs that causes a higher priority thread to
15+
become runnable, Calico will preempt the current thread. Unlike in common PC
16+
operating systems, Calico presently does not implement timeslicing to share
17+
the CPU between threads of the same priority; meaning it is necessary to
18+
explicitly yield control of the CPU if any such threads exist.
19+
20+
While Calico provides its own threading API, it is also possible to use standard
21+
threading APIs such as POSIX threads or C++ threads. These APIs are in fact
22+
preferred when working with cross platform projects.
23+
824
@{
925
*/
1026

@@ -14,8 +30,8 @@ typedef struct Thread Thread;
1430

1531
//! List of blocked threads, used as a building block for synchronization primitives
1632
typedef struct ThrListNode {
17-
Thread* next;
18-
Thread* prev;
33+
Thread* next; //!< @private
34+
Thread* prev; //!< @private
1935
} ThrListNode;
2036

2137
//! @private
@@ -46,8 +62,8 @@ typedef int (* ThreadFunc)(void* arg);
4662
struct Thread {
4763
ArmContext ctx; //!< CPU context structure
4864

49-
void* tp; //!< Virtual thread pointer register
50-
void* impure; //!< @private
65+
void* tp; //!< Virtual thread-local segment register
66+
void* impure; //!< Pointer to per-thread C standard library state
5167

5268
Thread* next; //!< @private
5369
ThrStatus status; //!< @private

0 commit comments

Comments
 (0)