summaryrefslogtreecommitdiff
path: root/docs/application/thread.md
diff options
context:
space:
mode:
Diffstat (limited to 'docs/application/thread.md')
-rw-r--r--docs/application/thread.md28
1 files changed, 12 insertions, 16 deletions
diff --git a/docs/application/thread.md b/docs/application/thread.md
index 59654e7..06410e6 100644
--- a/docs/application/thread.md
+++ b/docs/application/thread.md
@@ -5,15 +5,15 @@
## Object Definitions
```c
-typedef struct __kpl_task kpl_task;
+typedef struct _kpl_task kpl_task;
typedef void kpl_task_fn(kpl_task *t);
-typedef struct _kpl_task {
- kpl_task *_Atomic next, *join;
+typedef struct _task {
+ task *_Atomic next, *join;
kpl_group *state;
kpl_result return_value;
- kpl_task_fn *fn;
+ task_fn *fn;
int32_t thread_id;
_Atomic bool join_ready;
} task;
@@ -22,7 +22,7 @@ typedef struct _kpl_task {
typedef struct _kpl_task_slab {
size_t array_index;
- struct _task_slab *next;
+ struct _kpl_task_slab *next;
kpl_task array[KPL_TASK_SLAB_SIZE];
} kpl_task_slab;
@@ -31,12 +31,10 @@ typedef struct _kpl_task_slab {
#define KPL_MAIN_THREAD 0
typedef struct {
- kpl_task *_Atomic next;
-} kpl_task_dummy;
-
-typedef struct {
kpl_task *_Atomic head, *_Atomic tail;
- kpl_task_dummy dummy;
+ struct {
+ kpl_task *_Atomic next;
+ } dummy;
} kpl_atomic_queue;
typedef struct {
@@ -46,7 +44,7 @@ typedef struct {
kpl_task *pool;
sem_t counter;
pthread_t thread;
-} thread;
+} kpl_thread;
```
## Initialization
@@ -122,12 +120,10 @@ typedef struct _task_slab {
#define MAIN_THREAD 0
typedef struct {
- task *_Atomic next;
-} task_dummy;
-
-typedef struct {
task *_Atomic head, *_Atomic tail;
- task_dummy dummy;
+ struct {
+ task *_Atomic next;
+ } dummy;
} atomic_queue;
typedef struct {