acme
Foundational cross-platform layer of the ca2 framework
Loading...
Searching...
No Matches
types.h
1// Created by camilo on 2025-01-14 04:46 <3ThomasBorregaardSorensen!!
2#pragma once
3
4
5#include "acme/prototype/prototype/hash32.h"
6
8{
9 ::u32 ui0;
10 ::u32 ui1;
11 ::u32 ui2;
12 ::u32 ui3;
13 ::u32 ui4;
14 ::u32 ui5;
15 ::u32 ui6;
16 ::u32 ui7;
17};
18
19
20//#ifdef _TIME_H_
21//#error "time.h already included WHAT!!!!!!"
22//#endif
23
24//#include <pthread.h>
25
26//#ifdef _TIME_H_
27//#error "time.h already included WHAT!!!!!!"
28//#endif
29
30
31#ifdef WINDOWS
32
33
34#include "acme/operating_system/windows_common/handle.h"
35
36
37#endif
38
39
40class message_queue;
41
42
43//using htask = void *;
44
45// insight by listening lastmiles (Dennis Clarke) talk about pthread_equal (it may end up not to be an ::i32 but a pointer in some implementations ?, so should use pthread_equal...)
46class CLASS_DECL_ACME htask
47{
48public:
49
50#ifdef PARALLELIZATION_PTHREAD
51
52 hthread_t m_h;
53
54 htask(hthread_t h):m_h(h) {}
55
56#elif defined(WINDOWS)
57
58 ::uptr m_h;
59
60 htask(const ::uptr & h):m_h(h) {}
61
62#else
63
64 void * m_h;
65
66 htask(void * h):m_h(h) {}
67
68#endif
69
70 htask():m_h{} {}
71
72 htask(nullptr_t):m_h{} {}
73
74 htask(const htask & h):m_h(h.m_h) {}
75
76 htask & operator = (const htask & h) {m_h = h.m_h; return *this;}
77
78 bool operator == (const htask & h) const;
79
80 bool is_null() const;
81
82 bool is_set() const { return !is_null(); }
83
84 bool operator !() const { return is_null(); }
85
86
87};
88
89//using itask = iptr;
90
91// insight by listening lastmiles (Dennis Clarke) talk about pthread_equal (it may end up not to be an ::i32 but a pointer in some implementations ?, so should use pthread_equal...)
92class CLASS_DECL_ACME itask
93{
94public:
95
96#ifdef PARALLELIZATION_PTHREAD
97
98 hthread_t m_i;
99
100 itask(hthread_t i):m_i(i) {}
101
102#else
103
104 iptr m_i;
105
106 itask(iptr i):m_i(i) {}
107
108#endif
109
110 itask():m_i{} {}
111
112 itask(nullptr_t):m_i{} {}
113
114 itask(const itask & i):m_i(i.m_i) {}
115
116 itask & operator = (const itask & i) {m_i = i.m_i; return *this;}
117
118 bool operator == (const itask & i) const;
119
120 bool is_null() const;
121
122 bool is_set() const { return !is_null(); }
123
124 bool operator !() const { return is_null(); }
125
126 operator ::iptr() const { return *(::iptr*)&m_i; }
127
128};
129
130
131
132//class CLASS_DECL_ACME task_index
133//{
134//public:
135//
136//
137// iptr m_i32;
138//
139//
140// task_index(iptr i):m_i32(i) {}
141//
142// task_index():m_i32{} {}
143//
144// task_index(nullptr_t):m_i32{} {}
145//
146// task_index(const task_index & i):m_i32(i.m_i32) {}
147//
148// task_index & operator = (const task_index & i) {m_i32 = i.m_i32; return *this;}
149//
150// bool operator == (const task_index & i) const { return m_i32 == i.m_i32; }
151//
152// bool is_null() const { return operator==(nullptr); }
153//
154// bool is_set() const { return !is_null(); }
155//
156// bool operator !() const { return is_null(); }
157//
158//
159// operator hash32() const { return (hash32)m_i32; }
160//
161//
162//};
163//
164
165
166
167
168class CLASS_DECL_ACME thread_storage
169{
170public:
171
172 ::task_index m_taskindex;
173 htask m_htask;
174 itask m_itask;
175 ::pointer < ::task > m_ptask;
176 ::pointer < ::message_queue > m_pmessagequeue;
177
178};
179
180
181
182
Definition types.h:47
Definition types.h:93
Definition message_queue.h:16
Definition types.h:169
Definition types.h:8