diff options
| author | nodist <kevin.comas.git@gmail.com> | 2026-06-15 12:15:36 -0400 |
|---|---|---|
| committer | nodist <kevin.comas.git@gmail.com> | 2026-06-15 12:15:36 -0400 |
| commit | 2ec4d95567776f8211cd4588b295415b42876e5c (patch) | |
| tree | 745e38aacdf3252f00012bbcc3d22b932e278923 /docs/application | |
| parent | 59c467b56b36e50a84309da454a264ba59a746c0 (diff) | |
dummy on queue as anon struct
Diffstat (limited to 'docs/application')
| -rw-r--r-- | docs/application/thread.md | 28 |
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 { |
