forked from DanielTillett/Simple-Windows-Posix-Semaphore
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy paththreadingpool.h
More file actions
83 lines (54 loc) · 1.61 KB
/
Copy paththreadingpool.h
File metadata and controls
83 lines (54 loc) · 1.61 KB
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
83
// Copyright (C) 2026 The OnePointer Authors.
//
#ifndef _THREADINGPOOL_H_
#define _THREADINGPOOL_H_
#ifdef __cplusplus
extern "C" {
#endif
#include "semaphore_type.h"
#include "threading.h"
#include <pthread.h>
#include <stdint.h>
struct ThreadingTrajection;
typedef struct ThreadingQueue {
thread_t** joins;
struct timespec** join_timeouts;
size_t join_size;
size_t join_max_size;
struct ThreadingTrajection* join_epimorph_traj;
thread_t** waitings;
struct timespec** waiting_timeouts;
size_t waiting_size;
size_t waiting_max_size;
struct ThreadingTrajection* waiting_endomorph_traj;
struct ThreadingTrajection* epimorph_traj_startone;
struct ThreadingTrajection* endomorph_traj_threading;
thread_t* first;
thread_t* last;
thread_t** que;
} threading_queue_t;
typedef struct ThreadingNode {
thread_t* thrd;
semaphore_t* sem;
struct ThreadingNode* parent;
struct ThreadingNode** chlds;
struct ThreadingNode** leafs;
struct ThreadingTrajection* traj_parent_here;
struct ThreadingTrajection* traj_here_parent;
struct ThreadingTrajection* traj_spawn_fork;
struct ThreadingTrajection* traj_to_children;
struct ThreadingQueue* queue;
} threading_node_t;
typedef struct ThreadingPool {
thread_t* root;
thread_t** threads;
size_t pool_size;
threading_node_t** nodes;
threading_node_t* node_root;
threading_node_t* node_current;
thread_t* first;
} threading_pool_t;
#ifdef __cplusplus
}
#endif
#endif // _THREADINGPOOL_H_