summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcarlos <caiosignor@gmail.com>2020-04-03 16:44:09 -0300
committerJoão Paulo Taylor Ienczak Zanette <jpaulotiz@gmail.com>2020-04-29 12:13:38 -0300
commitb8525700138e3e812847e723c53aab107ba1d9e4 (patch)
treeeab3afc699e184b810b873bb593ad2d2ea239094
parent3bd220796fa5df25942136eb26045b71f9c3fb0e (diff)
Removed unnecessary comments and lines.
Created eina_sched_{win32,posix}.c Now _eina_sched_prio_drop is in this file, not in eina_thread{win32,posix}.c No more function about pthreads in eina_thread.c Functions wrappers declared into eina_thread.h Removed somes #ifdef linux
-rw-r--r--src/lib/eina/eina_debug_cpu.c1
-rw-r--r--src/lib/eina/eina_debug_timer.c176
-rw-r--r--src/lib/eina/eina_evlog.c1
-rw-r--r--src/lib/eina/eina_main.c20
-rw-r--r--src/lib/eina/eina_sched.c7
-rw-r--r--src/lib/eina/eina_sched.h5
-rw-r--r--src/lib/eina/eina_sched_posix.c70
-rw-r--r--src/lib/eina/eina_sched_win32.c64
-rw-r--r--src/lib/eina/eina_thread.c89
-rw-r--r--src/lib/eina/eina_thread.h28
-rw-r--r--src/lib/eina/eina_thread_posix.c91
-rw-r--r--src/lib/eina/eina_thread_win32.c78
-rw-r--r--src/lib/eina/meson.build4
-rw-r--r--src/lib/evil/unposix/pthread.h54
14 files changed, 395 insertions, 293 deletions
diff --git a/src/lib/eina/eina_debug_cpu.c b/src/lib/eina/eina_debug_cpu.c
index cce4f849bc..8edbb79db5 100644
--- a/src/lib/eina/eina_debug_cpu.c
+++ b/src/lib/eina/eina_debug_cpu.c
@@ -129,7 +129,6 @@ _sysmon(void *data EINA_UNUSED, Eina_Thread thr EINA_UNUSED)
129 #ifndef _WIN32 129 #ifndef _WIN32
130 pthread_getcpuclockid(thread, &cid); 130 pthread_getcpuclockid(thread, &cid);
131 #endif 131 #endif
132 //pthread_getcpuclockid(thread, &cid);
133 clock_gettime(cid, &t); 132 clock_gettime(cid, &t);
134 // calculate a long timestamp (64bits) 133 // calculate a long timestamp (64bits)
135 tim1 = (_eina_debug_thread_active[i].clok.tv_sec * 1000000000LL) + 134 tim1 = (_eina_debug_thread_active[i].clok.tv_sec * 1000000000LL) +
diff --git a/src/lib/eina/eina_debug_timer.c b/src/lib/eina/eina_debug_timer.c
index d4ff5e0c42..b55cffb3a6 100644
--- a/src/lib/eina/eina_debug_timer.c
+++ b/src/lib/eina/eina_debug_timer.c
@@ -16,9 +16,9 @@
16 * if not, see <http://www.gnu.org/licenses/>. 16 * if not, see <http://www.gnu.org/licenses/>.
17 */ 17 */
18 18
19# ifndef _GNU_SOURCE 19#ifndef _GNU_SOURCE
20# define _GNU_SOURCE 1 20# define _GNU_SOURCE 1
21# endif 21#endif
22 22
23#ifdef HAVE_CONFIG_H 23#ifdef HAVE_CONFIG_H
24# include <config.h> 24# include <config.h>
@@ -56,7 +56,6 @@ struct _Eina_Debug_Timer
56static Eina_List *_timers = NULL; 56static Eina_List *_timers = NULL;
57 57
58static Eina_Bool _thread_runs = EINA_FALSE; 58static Eina_Bool _thread_runs = EINA_FALSE;
59//static pthread_t _thread;
60static Eina_Thread _thread; 59static Eina_Thread _thread;
61 60
62static int pipeToThread[2]; 61static int pipeToThread[2];
@@ -69,24 +68,24 @@ _timer_append(Eina_Debug_Timer *t)
69 unsigned int prev_time = 0; 68 unsigned int prev_time = 0;
70 char c = '\0'; 69 char c = '\0';
71 EINA_LIST_FOREACH(_timers, itr, t2) 70 EINA_LIST_FOREACH(_timers, itr, t2)
72 { 71 {
73 if (t2->timeout > t->timeout) goto end; 72 if (t2->timeout > t->timeout) goto end;
74 prev_time = t2->timeout; 73 prev_time = t2->timeout;
75 } 74 }
76 t2 = NULL; 75 t2 = NULL;
77end: 76end:
78 t->rel_time = t->timeout - prev_time; 77 t->rel_time = t->timeout - prev_time;
79 if (!t2) _timers = eina_list_append(_timers, t); 78 if (!t2) _timers = eina_list_append(_timers, t);
80 else _timers = eina_list_prepend_relative(_timers, t, t2); 79 else _timers = eina_list_prepend_relative(_timers, t, t2);
81 if (write(pipeToThread[1], &c, 1) != 1) 80 if (write(pipeToThread[1], &c, 1) != 1)
82 e_debug("EINA DEBUG ERROR: Can't wake up thread for debug timer"); 81 e_debug("EINA DEBUG ERROR: Can't wake up thread for debug timer");
83} 82}
84 83
85static void * 84static void *
86_monitor(void *_data EINA_UNUSED) 85_monitor(void *_data EINA_UNUSED)
87{ 86{
88#ifdef HAVE_SYS_EPOLL_H 87#ifdef HAVE_SYS_EPOLL_H
89#define MAX_EVENTS 4 88# define MAX_EVENTS 4
90 struct epoll_event event; 89 struct epoll_event event;
91 struct epoll_event events[MAX_EVENTS]; 90 struct epoll_event events[MAX_EVENTS];
92 int epfd = epoll_create(MAX_EVENTS), ret; 91 int epfd = epoll_create(MAX_EVENTS), ret;
@@ -95,54 +94,53 @@ _monitor(void *_data EINA_UNUSED)
95 event.events = EPOLLIN; 94 event.events = EPOLLIN;
96 ret = epoll_ctl(epfd, EPOLL_CTL_ADD, event.data.fd, &event); 95 ret = epoll_ctl(epfd, EPOLL_CTL_ADD, event.data.fd, &event);
97 if (ret) perror("epoll_ctl/add"); 96 if (ret) perror("epoll_ctl/add");
98#ifdef EINA_HAVE_PTHREAD_SETNAME 97# ifdef EINA_HAVE_PTHREAD_SETNAME
98 eina_thread_name_set(eina_thread_self(), "Edbg-tim");
99# endif
99 100
100 eina_thread_name_set(eina_thread_self(), "Edbg-tim");
101#endif
102
103 while (1) 101 while (1)
104 { 102 {
105 int timeout = -1; //in milliseconds 103 int timeout = -1; //in milliseconds
106 #ifndef _WIN32 104# ifndef _WIN32
107 pthread_testcancel(); 105 pthread_testcancel();
108 #endif 106# endif
109 eina_spinlock_take(&_lock); 107 eina_spinlock_take(&_lock);
110 if (_timers) 108 if (_timers)
111 { 109 {
112 Eina_Debug_Timer *t = eina_list_data_get(_timers); 110 Eina_Debug_Timer *t = eina_list_data_get(_timers);
113 timeout = t->timeout; 111 timeout = t->timeout;
114 } 112 }
115 eina_spinlock_release(&_lock); 113 eina_spinlock_release(&_lock);
116 114
117 ret = epoll_wait(epfd, events, MAX_EVENTS, timeout); 115 ret = epoll_wait(epfd, events, MAX_EVENTS, timeout);
118 #ifndef _WIN32 116# ifndef _WIN32
119 pthread_testcancel(); 117 pthread_testcancel();
120 #endif 118# endif
121 119
122 /* Some timer has been add/removed or we need to exit */ 120 /* Some timer has been add/removed or we need to exit */
123 if (ret) 121 if (ret)
124 { 122 {
125 char c; 123 char c;
126 if (read(pipeToThread[0], &c, 1) != 1) break; 124 if (read(pipeToThread[0], &c, 1) != 1) break;
127 } 125 }
128 else 126 else
129 { 127 {
130 Eina_List *itr, *itr2, *renew = NULL; 128 Eina_List *itr, *itr2, *renew = NULL;
131 Eina_Debug_Timer *t; 129 Eina_Debug_Timer *t;
132 eina_spinlock_take(&_lock); 130 eina_spinlock_take(&_lock);
133 EINA_LIST_FOREACH_SAFE(_timers, itr, itr2, t) 131 EINA_LIST_FOREACH_SAFE(_timers, itr, itr2, t)
134 { 132 {
135 if (itr == _timers || t->rel_time == 0) 133 if (itr == _timers || t->rel_time == 0)
136 { 134 {
137 _timers = eina_list_remove(_timers, t); 135 _timers = eina_list_remove(_timers, t);
138 if (t->cb(t->data)) renew = eina_list_append(renew, t); 136 if (t->cb(t->data)) renew = eina_list_append(renew, t);
139 else free(t); 137 else free(t);
140 } 138 }
141 } 139 }
142 EINA_LIST_FREE(renew, t) _timer_append(t); 140 EINA_LIST_FREE(renew, t) _timer_append(t);
143 eina_spinlock_release(&_lock); 141 eina_spinlock_release(&_lock);
144 } 142 }
145 } 143 }
146#endif 144#endif
147 _thread_runs = EINA_FALSE; 145 _thread_runs = EINA_FALSE;
148 close(pipeToThread[0]); 146 close(pipeToThread[0]);
@@ -161,36 +159,36 @@ eina_debug_timer_add(unsigned int timeout_ms, Eina_Debug_Timer_Cb cb, void *data
161 eina_spinlock_take(&_lock); 159 eina_spinlock_take(&_lock);
162 _timer_append(t); 160 _timer_append(t);
163 if (!_thread_runs) 161 if (!_thread_runs)
164 { 162 {
165#ifndef _WIN32 163#ifndef _WIN32
166 sigset_t oldset, newset; 164 sigset_t oldset, newset;
167 165
168 sigemptyset(&newset); 166 sigemptyset(&newset);
169 sigaddset(&newset, SIGPIPE); 167 sigaddset(&newset, SIGPIPE);
170 sigaddset(&newset, SIGALRM); 168 sigaddset(&newset, SIGALRM);
171 sigaddset(&newset, SIGCHLD); 169 sigaddset(&newset, SIGCHLD);
172 sigaddset(&newset, SIGUSR1); 170 sigaddset(&newset, SIGUSR1);
173 sigaddset(&newset, SIGUSR2); 171 sigaddset(&newset, SIGUSR2);
174 sigaddset(&newset, SIGHUP); 172 sigaddset(&newset, SIGHUP);
175 sigaddset(&newset, SIGQUIT); 173 sigaddset(&newset, SIGQUIT);
176 sigaddset(&newset, SIGINT); 174 sigaddset(&newset, SIGINT);
177 sigaddset(&newset, SIGTERM); 175 sigaddset(&newset, SIGTERM);
178# ifdef SIGPWR 176# ifdef SIGPWR
179 sigaddset(&newset, SIGPWR); 177 sigaddset(&newset, SIGPWR);
180# endif 178# endif
181 pthread_sigmask(SIG_BLOCK, &newset, &oldset); 179 pthread_sigmask(SIG_BLOCK, &newset, &oldset);
182#endif 180#endif
183 int err = pthread_create(&_thread, NULL, _monitor, NULL); 181 int err = pthread_create(&_thread, NULL, _monitor, NULL);
184#ifndef _WIN32 182#ifndef _WIN32
185 pthread_sigmask(SIG_SETMASK, &oldset, NULL); 183 pthread_sigmask(SIG_SETMASK, &oldset, NULL);
186#endif 184#endif
187 if (err != 0) 185 if (err != 0)
188 { 186 {
189 e_debug("EINA DEBUG ERROR: Can't create debug timer thread!"); 187 e_debug("EINA DEBUG ERROR: Can't create debug timer thread!");
190 abort(); 188 abort();
191 } 189 }
192 _thread_runs = EINA_TRUE; 190 _thread_runs = EINA_TRUE;
193 } 191 }
194 eina_spinlock_release(&_lock); 192 eina_spinlock_release(&_lock);
195 return t; 193 return t;
196} 194}
@@ -201,10 +199,10 @@ eina_debug_timer_del(Eina_Debug_Timer *t)
201 eina_spinlock_take(&_lock); 199 eina_spinlock_take(&_lock);
202 Eina_List *itr = eina_list_data_find_list(_timers, t); 200 Eina_List *itr = eina_list_data_find_list(_timers, t);
203 if (itr) 201 if (itr)
204 { 202 {
205 _timers = eina_list_remove_list(_timers, itr); 203 _timers = eina_list_remove_list(_timers, itr);
206 free(t); 204 free(t);
207 } 205 }
208 eina_spinlock_release(&_lock); 206 eina_spinlock_release(&_lock);
209} 207}
210 208
@@ -214,7 +212,7 @@ _eina_debug_timer_init(void)
214 eina_spinlock_new(&_lock); 212 eina_spinlock_new(&_lock);
215#ifndef _WIN32 213#ifndef _WIN32
216 if (pipe(pipeToThread) == -1) 214 if (pipe(pipeToThread) == -1)
217 return EINA_FALSE; 215 return EINA_FALSE;
218#endif 216#endif
219 return EINA_TRUE; 217 return EINA_TRUE;
220} 218}
@@ -226,16 +224,14 @@ _eina_debug_timer_shutdown(void)
226 224
227 eina_spinlock_take(&_lock); 225 eina_spinlock_take(&_lock);
228 EINA_LIST_FREE(_timers, t) 226 EINA_LIST_FREE(_timers, t)
229 free(t); 227 free(t);
230 close(pipeToThread[0]); 228 close(pipeToThread[0]);
231 close(pipeToThread[1]); 229 close(pipeToThread[1]);
232 if (_thread_runs) 230 if (_thread_runs)
233 eina_thread_cancel(_thread); 231 eina_thread_cancel(_thread);
234
235 _thread_runs = 0; 232 _thread_runs = 0;
236 eina_spinlock_release(&_lock); 233 eina_spinlock_release(&_lock);
237 eina_spinlock_free(&_lock); 234 eina_spinlock_free(&_lock);
238 235
239 return EINA_TRUE; 236 return EINA_TRUE;
240} 237}
241
diff --git a/src/lib/eina/eina_evlog.c b/src/lib/eina/eina_evlog.c
index bebf8e9d41..3b427e0944 100644
--- a/src/lib/eina/eina_evlog.c
+++ b/src/lib/eina/eina_evlog.c
@@ -176,7 +176,6 @@ eina_evlog(const char *event, void *obj, double srctime, const char *detail)
176 item = (Eina_Evlog_Item *)strings; 176 item = (Eina_Evlog_Item *)strings;
177 item->tim = SWAP_DBL(now); 177 item->tim = SWAP_DBL(now);
178 item->srctim = SWAP_DBL(srctime); 178 item->srctim = SWAP_DBL(srctime);
179 //item->thread = SWAP_64((unsigned long long)(uintptr_t)pthread_self());
180 item->thread = SWAP_64((unsigned long long)(uintptr_t)eina_thread_self()); 179 item->thread = SWAP_64((unsigned long long)(uintptr_t)eina_thread_self());
181 item->obj = SWAP_64((unsigned long long)(uintptr_t)obj); 180 item->obj = SWAP_64((unsigned long long)(uintptr_t)obj);
182 item->event_offset = SWAP_16(sizeof(Eina_Evlog_Item)); 181 item->event_offset = SWAP_16(sizeof(Eina_Evlog_Item));
diff --git a/src/lib/eina/eina_main.c b/src/lib/eina/eina_main.c
index 4553436aa3..9ba8c2220a 100644
--- a/src/lib/eina/eina_main.c
+++ b/src/lib/eina/eina_main.c
@@ -297,7 +297,6 @@ eina_init(void)
297#endif 297#endif
298 298
299#ifdef EFL_HAVE_THREADS 299#ifdef EFL_HAVE_THREADS
300
301 _eina_main_loop = eina_thread_self(); 300 _eina_main_loop = eina_thread_self();
302#endif 301#endif
303 302
@@ -389,11 +388,9 @@ eina_threads_init(void)
389{ 388{
390#ifdef EFL_HAVE_THREADS 389#ifdef EFL_HAVE_THREADS
391 int ret; 390 int ret;
392 391# ifdef EINA_HAVE_DEBUG_THREADS
393#ifdef EINA_HAVE_DEBUG_THREADS
394
395 assert(eina_thread_equal(_eina_main_loop, eina_thread_self())); 392 assert(eina_thread_equal(_eina_main_loop, eina_thread_self()));
396#endif 393# endif
397 394
398 ++_eina_main_thread_count; 395 ++_eina_main_thread_count;
399 ret = _eina_main_thread_count; 396 ret = _eina_main_thread_count;
@@ -417,11 +414,10 @@ eina_threads_shutdown(void)
417#ifdef EFL_HAVE_THREADS 414#ifdef EFL_HAVE_THREADS
418 int ret; 415 int ret;
419 416
420#ifdef EINA_HAVE_DEBUG_THREADS 417# ifdef EINA_HAVE_DEBUG_THREADS
421
422 assert(eina_thread_equal(_eina_main_loop, eina_thread_self())); 418 assert(eina_thread_equal(_eina_main_loop, eina_thread_self()));
423 assert(_eina_main_thread_count > 0); 419 assert(_eina_main_thread_count > 0);
424#endif 420# endif
425 421
426 ret = --_eina_main_thread_count; 422 ret = --_eina_main_thread_count;
427 if(_eina_main_thread_count > 0) 423 if(_eina_main_thread_count > 0)
@@ -443,11 +439,9 @@ eina_main_loop_is(void)
443# ifdef __GNUC__ 439# ifdef __GNUC__
444 /* pthread_self() can't be optimized, it's a single asm "movl" */ 440 /* pthread_self() can't be optimized, it's a single asm "movl" */
445 if (__builtin_types_compatible_p(pthread_t, unsigned long int)) 441 if (__builtin_types_compatible_p(pthread_t, unsigned long int))
446
447 return (eina_thread_self() == _eina_main_loop); 442 return (eina_thread_self() == _eina_main_loop);
448 else 443 else
449# endif 444# endif
450
451 if (eina_thread_equal(_eina_main_loop, eina_thread_self())) 445 if (eina_thread_equal(_eina_main_loop, eina_thread_self()))
452 return EINA_TRUE; 446 return EINA_TRUE;
453#endif 447#endif
@@ -458,12 +452,8 @@ eina_main_loop_is(void)
458EAPI void 452EAPI void
459eina_main_loop_define(void) 453eina_main_loop_define(void)
460{ 454{
461#ifdef EFL_HAVE_THREADS 455#ifdef EFL_HAVE_THREADS
462
463 _eina_main_loop = eina_thread_self(); 456 _eina_main_loop = eina_thread_self();
464#endif 457#endif
465} 458}
466 459
467/**
468 * @}
469 */
diff --git a/src/lib/eina/eina_sched.c b/src/lib/eina/eina_sched.c
index a1300986b3..5bef0e6291 100644
--- a/src/lib/eina/eina_sched.c
+++ b/src/lib/eina/eina_sched.c
@@ -21,13 +21,6 @@
21#endif 21#endif
22#include "eina_thread.h" 22#include "eina_thread.h"
23 23
24#ifdef __linux__
25#include <sched.h>
26#include <sys/time.h>
27#include <sys/resource.h>
28#include <errno.h>
29#endif
30
31#include "eina_sched.h" 24#include "eina_sched.h"
32#include "eina_log.h" 25#include "eina_log.h"
33 26
diff --git a/src/lib/eina/eina_sched.h b/src/lib/eina/eina_sched.h
index 13f35a4476..5c066a1d28 100644
--- a/src/lib/eina/eina_sched.h
+++ b/src/lib/eina/eina_sched.h
@@ -30,7 +30,9 @@
30#define EINA_SCHED_H_ 30#define EINA_SCHED_H_
31 31
32#include "eina_types.h" 32#include "eina_types.h"
33 33#include "eina_thread.h"
34#define RTNICENESS 1
35#define NICENESS 5
34 36
35/** 37/**
36 * @brief Lowers the priority of the current thread. 38 * @brief Lowers the priority of the current thread.
@@ -44,6 +46,7 @@
44 * only one that is implemented as of now. In this case, the nice level is 46 * only one that is implemented as of now. In this case, the nice level is
45 * incremented on this thread by @c NICENESS. 47 * incremented on this thread by @c NICENESS.
46 */ 48 */
49inline void _eina_sched_prio_drop(void);
47EAPI void eina_sched_prio_drop(void); 50EAPI void eina_sched_prio_drop(void);
48 51
49/** 52/**
diff --git a/src/lib/eina/eina_sched_posix.c b/src/lib/eina/eina_sched_posix.c
new file mode 100644
index 0000000000..0060471e32
--- /dev/null
+++ b/src/lib/eina/eina_sched_posix.c
@@ -0,0 +1,70 @@
1/* EINA - EFL data type library
2 * Copyright (C) 2010 ProFUSION embedded systems
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library;
16 * if not, see <http://www.gnu.org/licenses/>.
17 */
18
19#include "eina_sched.h"
20#include <sched.h>
21#include <sys/time.h>
22#include <sys/resource.h>
23#include <errno.h>
24#include <pthread.h>
25
26inline void _eina_sched_prio_drop(void)
27{
28 struct sched_param param;
29 int pol, ret;
30 Eina_Thread pthread_id;
31
32 pthread_id = eina_thread_self();
33 ret = pthread_getschedparam(pthread_id, &pol, &param);
34 if (ret)
35 {
36 EINA_LOG_ERR("Unable to query sched parameters");
37 return;
38 }
39
40 if (EINA_UNLIKELY(pol == SCHED_RR || pol == SCHED_FIFO))
41 {
42 param.sched_priority -= RTNICENESS;
43
44 /* We don't change the policy */
45 if (param.sched_priority < 1)
46 {
47 EINA_LOG_INFO("RT prio < 1, setting to 1 instead");
48 param.sched_priority = 1;
49 }
50
51 pthread_setschedparam(pthread_id, pol, &param);
52 }
53 else
54 {
55 int prio;
56 errno = 0;
57 prio = getpriority(PRIO_PROCESS, 0);
58 if (errno == 0)
59 {
60 prio += NICENESS;
61 if (prio > 19)
62 {
63 EINA_LOG_INFO("Max niceness reached; keeping max (19)");
64 prio = 19;
65 }
66
67 setpriority(PRIO_PROCESS, 0, prio);
68 }
69 }
70} \ No newline at end of file
diff --git a/src/lib/eina/eina_sched_win32.c b/src/lib/eina/eina_sched_win32.c
new file mode 100644
index 0000000000..9f29d857b2
--- /dev/null
+++ b/src/lib/eina/eina_sched_win32.c
@@ -0,0 +1,64 @@
1/* EINA - EFL data type library
2 * Copyright (C) 2020 Carlos Signor
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library;
16 * if not, see <http://www.gnu.org/licenses/>.
17 */
18
19#include "eina_sched.h"
20#ifndef WIN32_LEAN_AND_MEAN
21 #define WIN32_LEAN_AND_MEAN
22#endif
23#include <Windows.h>
24
25inline void _eina_sched_prio_drop(void)
26{
27 Eina_Thread pthread_id;
28 int sched_priority;
29
30 pthread_id = eina_thread_self();
31
32 sched_priority = GetThreadPriority((HANDLE)pthread_id);
33
34 if (EINA_UNLIKELY(sched_priority == THREAD_PRIORITY_TIME_CRITICAL))
35 {
36 sched_priority -= RTNICENESS;
37
38 /* We don't change the policy */
39 if (sched_priority < 1)
40 {
41 EINA_LOG_INFO("RT prio < 1, setting to 1 instead");
42 sched_priority = 1;
43 }
44 if (!SetThreadPriority((HANDLE)pthread_id, sched_priority))
45 {
46 EINA_LOG_ERR("Unable to query sched parameters");
47 }
48 }
49 else
50 {
51 sched_priority += NICENESS;
52
53 /* We don't change the policy */
54 if (sched_priority > THREAD_PRIORITY_TIME_CRITICAL)
55 {
56 EINA_LOG_INFO("Max niceness reached; keeping max (THREAD_PRIORITY_TIME_CRITICAL)");
57 sched_priority = THREAD_PRIORITY_TIME_CRITICAL;
58 }
59 if (!SetThreadPriority((HANDLE)pthread_id, sched_priority))
60 {
61 EINA_LOG_ERR("Unable to query sched parameters");
62 }
63 }
64}
diff --git a/src/lib/eina/eina_thread.c b/src/lib/eina/eina_thread.c
index 1c2a307dd8..0a33c12a8d 100644
--- a/src/lib/eina/eina_thread.c
+++ b/src/lib/eina/eina_thread.c
@@ -23,7 +23,7 @@
23#include <stdlib.h> 23#include <stdlib.h>
24 24
25#include "eina_config.h" 25#include "eina_config.h"
26#include "eina_lock.h" /* it will include pthread.h with proper flags */ 26#include "eina_lock.h"
27#include "eina_thread.h" 27#include "eina_thread.h"
28#include "eina_sched.h" 28#include "eina_sched.h"
29#include "eina_cpu.h" 29#include "eina_cpu.h"
@@ -40,13 +40,10 @@
40# include <string.h> 40# include <string.h>
41 41
42#if defined(EINA_HAVE_PTHREAD_AFFINITY) || defined(EINA_HAVE_PTHREAD_SETNAME) 42#if defined(EINA_HAVE_PTHREAD_AFFINITY) || defined(EINA_HAVE_PTHREAD_SETNAME)
43#ifndef __linux__ 43# define cpu_set_t cpuset_t
44#include <pthread_np.h>
45#define cpu_set_t cpuset_t
46#endif
47#endif 44#endif
48 45
49static void *_eina_internal_call(void *context); 46
50 47
51EAPI Eina_Thread 48EAPI Eina_Thread
52eina_thread_self(void) 49eina_thread_self(void)
@@ -59,7 +56,32 @@ eina_thread_equal(Eina_Thread t1, Eina_Thread t2)
59{ 56{
60 return !!_eina_thread_equal(t1, t2); 57 return !!_eina_thread_equal(t1, t2);
61} 58}
59static void *_eina_internal_call(void *context)
60{
61 Eina_Thread_Call *c = context;
62 void *r;
63 Eina_Thread self;
64
65
66 // Default this thread to not cancellable as per Eina documentation
67 eina_thread_cancellable_set(EINA_FALSE, NULL);
62 68
69 EINA_THREAD_CLEANUP_PUSH(free, c);
70
71 if (c->prio == EINA_THREAD_BACKGROUND || c->prio == EINA_THREAD_IDLE)
72 eina_sched_prio_drop();
73
74
75 self = eina_thread_self();
76
77 _eina_debug_thread_add(&self);
78 EINA_THREAD_CLEANUP_PUSH(_eina_debug_thread_del, &self);
79 r = c->func((void*) c->data, eina_thread_self());
80 EINA_THREAD_CLEANUP_POP(EINA_TRUE);
81 EINA_THREAD_CLEANUP_POP(EINA_TRUE);
82
83 return r;
84}
63EAPI Eina_Bool 85EAPI Eina_Bool
64eina_thread_create(Eina_Thread *t, 86eina_thread_create(Eina_Thread *t,
65 Eina_Thread_Priority prio, int affinity, 87 Eina_Thread_Priority prio, int affinity,
@@ -104,7 +126,7 @@ eina_thread_name_set(Eina_Thread t, const char *name)
104 buf[15] = 0; 126 buf[15] = 0;
105 } 127 }
106 else buf[0] = 0; 128 else buf[0] = 0;
107 if (_eina_thread_set_name(t, buf) == 0) return EINA_TRUE; 129 if (_eina_thread_name_set(t, buf) == 0) return EINA_TRUE;
108#else 130#else
109 (void)t; 131 (void)t;
110 (void)name; 132 (void)name;
@@ -122,36 +144,13 @@ eina_thread_cancel(Eina_Thread t)
122EAPI Eina_Bool 144EAPI Eina_Bool
123eina_thread_cancellable_set(Eina_Bool cancellable, Eina_Bool *was_cancellable) 145eina_thread_cancellable_set(Eina_Bool cancellable, Eina_Bool *was_cancellable)
124{ 146{
125 int state = cancellable ? EINA_THREAD_CANCEL_ENABLE : EINA_THREAD_CANCEL_DISABLE; 147 return _eina_thread_cancellable_set(cancellable,was_cancellable);
126 int old = 0;
127 int r;
128 #ifndef _WIN32
129 /* enforce deferred in case users changed to asynchronous themselves */
130
131 pthread_setcanceltype(EINA_THREAD_CANCEL_DEFERRED, &old);
132
133 r = pthread_setcancelstate(state, &old);
134 if (was_cancellable && r == 0)
135 *was_cancellable = (old == EINA_THREAD_CANCEL_ENABLE);
136 return r == 0;
137 #else
138 if(!state){
139 *was_cancellable = EINA_TRUE;
140 return EINA_FALSE;
141 }else{
142 *was_cancellable = EINA_TRUE;
143 return EINA_TRUE;
144 }
145 #endif
146} 148}
147 149
148EAPI void 150EAPI void
149eina_thread_cancel_checkpoint(void) 151eina_thread_cancel_checkpoint(void)
150{ 152{
151 #ifndef _WIN32 153 _eina_thread_cancel_checkpoint();
152 pthread_testcancel();
153 #endif
154
155} 154}
156 155
157EAPI void * 156EAPI void *
@@ -182,29 +181,3 @@ eina_thread_shutdown(void)
182 return EINA_TRUE; 181 return EINA_TRUE;
183} 182}
184 183
185static void *_eina_internal_call(void *context)
186{
187 Eina_Thread_Call *c = context;
188 void *r;
189 Eina_Thread self;
190
191
192 // Default this thread to not cancellable as per Eina documentation
193 eina_thread_cancellable_set(EINA_FALSE, NULL);
194
195 EINA_THREAD_CLEANUP_PUSH(free, c);
196
197 if (c->prio == EINA_THREAD_BACKGROUND || c->prio == EINA_THREAD_IDLE)
198 eina_sched_prio_drop();
199
200
201 self = eina_thread_self();
202
203 _eina_debug_thread_add(&self);
204 EINA_THREAD_CLEANUP_PUSH(_eina_debug_thread_del, &self);
205 r = c->func((void*) c->data, eina_thread_self());
206 EINA_THREAD_CLEANUP_POP(EINA_TRUE);
207 EINA_THREAD_CLEANUP_POP(EINA_TRUE);
208
209 return r;
210} \ No newline at end of file
diff --git a/src/lib/eina/eina_thread.h b/src/lib/eina/eina_thread.h
index 368046ca63..0ee17e9cd7 100644
--- a/src/lib/eina/eina_thread.h
+++ b/src/lib/eina/eina_thread.h
@@ -336,10 +336,8 @@ typedef void *(*Eina_Thread_Cancellable_Run_Cb)(void *data);
336 * 336 *
337 * @since 1.19 337 * @since 1.19
338 */ 338 */
339
340EAPI void *eina_thread_cancellable_run(Eina_Thread_Cancellable_Run_Cb cb, Eina_Free_Cb cleanup_cb, void *data); 339EAPI void *eina_thread_cancellable_run(Eina_Thread_Cancellable_Run_Cb cb, Eina_Free_Cb cleanup_cb, void *data);
341 340
342
343typedef struct _Eina_Thread_Call Eina_Thread_Call; 341typedef struct _Eina_Thread_Call Eina_Thread_Call;
344struct _Eina_Thread_Call 342struct _Eina_Thread_Call
345{ 343{
@@ -350,11 +348,23 @@ struct _Eina_Thread_Call
350 int affinity; 348 int affinity;
351}; 349};
352/* 350/*
353 * These defines are used by eina_sched to drop the thread priority 351 * Those are the functions definitions of wrappers that will implements the functions
352 * above with win32 and posix api
354 */ 353 */
355 354inline Eina_Thread _eina_thread_self(void);
356#define RTNICENESS 1 355inline Eina_Bool _eina_thread_equal(Eina_Thread t1, Eina_Thread t2);
357#define NICENESS 5 356inline Eina_Bool _eina_thread_create(Eina_Thread *t,
357 int affinity,
358 void *(*func)(void *data),
359 void *data);
360inline void *_eina_thread_join(Eina_Thread t);
361Eina_Bool _eina_thread_name_set(Eina_Thread thread, char *buf);
362Eina_Bool _eina_thread_cancel(Eina_Thread thread);
363void _eina_thread_setcanceltype(int type, int *oldtype);
364void _eina_thread_cancel_checkpoint();
365EAPI Eina_Bool _eina_thread_cancellable_set(Eina_Bool cancellable, Eina_Bool *was_cancellable);
366int _eina_thread_setcancelstate(int type, int *oldtype);
367void _eina_thread_set_priority(Eina_Thread_Priority prio, Eina_Thread *t);
358 368
359#ifdef _WIN32 369#ifdef _WIN32
360# define EINA_THREAD_CANCEL_ENABLE 0 370# define EINA_THREAD_CANCEL_ENABLE 0
@@ -370,12 +380,6 @@ struct _Eina_Thread_Call
370# define EINA_THREAD_CANCELED PTHREAD_CANCELED 380# define EINA_THREAD_CANCELED PTHREAD_CANCELED
371#endif 381#endif
372 382
373
374
375/**
376 * @}
377 */
378
379/** 383/**
380 * @} 384 * @}
381 */ 385 */
diff --git a/src/lib/eina/eina_thread_posix.c b/src/lib/eina/eina_thread_posix.c
index 09fc83a288..bea3f83cfd 100644
--- a/src/lib/eina/eina_thread_posix.c
+++ b/src/lib/eina/eina_thread_posix.c
@@ -1,5 +1,5 @@
1/* EINA - EFL data type library 1/* EINA - EFL data type library
2 * Copyright (C) 2012 Cedric Bail 2 * Copyright (C) 2020 Carlos Signor
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public 5 * modify it under the terms of the GNU Lesser General Public
@@ -23,7 +23,7 @@
23#include <stdlib.h> 23#include <stdlib.h>
24 24
25#include "eina_config.h" 25#include "eina_config.h"
26#include "eina_lock.h" /* it will include pthread.h with proper flags */ 26#include "eina_lock.h"
27#include "eina_thread.h" 27#include "eina_thread.h"
28#include "eina_sched.h" 28#include "eina_sched.h"
29#include "eina_cpu.h" 29#include "eina_cpu.h"
@@ -55,14 +55,14 @@ _eina_thread_join(Eina_Thread t)
55 return NULL; 55 return NULL;
56} 56}
57 57
58Eina_Bool _eina_thread_set_name(Eina_Thread thread, char *buf) 58Eina_Bool _eina_thread_name_set(Eina_Thread thread, char *buf)
59{ 59{
60 #ifndef __linux__ 60#ifndef __linux__
61 pthread_set_name_np((pthread_t)t, buf) 61 pthread_set_name_np((pthread_t)t, buf);
62 return EINA_TRUE; 62 return EINA_TRUE;
63 #else 63#else
64 return pthread_setname_np((pthread_t)thread, buf); 64 return pthread_setname_np((pthread_t)thread, buf);
65 #endif 65#endif
66} 66}
67 67
68inline Eina_Bool 68inline Eina_Bool
@@ -75,7 +75,7 @@ _eina_thread_create(Eina_Thread *t, int affinity, void *(*func)(void *data), voi
75 75
76 pthread_attr_init(&attr); 76 pthread_attr_init(&attr);
77 if (affinity >= 0) 77 if (affinity >= 0)
78 { 78 {
79#ifdef EINA_HAVE_PTHREAD_AFFINITY 79#ifdef EINA_HAVE_PTHREAD_AFFINITY
80 cpu_set_t cpu; 80 cpu_set_t cpu;
81 81
@@ -83,7 +83,7 @@ _eina_thread_create(Eina_Thread *t, int affinity, void *(*func)(void *data), voi
83 CPU_SET(affinity, &cpu); 83 CPU_SET(affinity, &cpu);
84 pthread_attr_setaffinity_np(&attr, sizeof(cpu), &cpu); 84 pthread_attr_setaffinity_np(&attr, sizeof(cpu), &cpu);
85#endif 85#endif
86 } 86 }
87 87
88 /* setup initial locks */ 88 /* setup initial locks */
89 89
@@ -129,48 +129,31 @@ _eina_thread_self(void)
129{ 129{
130 return (Eina_Thread)pthread_self(); 130 return (Eina_Thread)pthread_self();
131} 131}
132inline void _eina_sched_prio_drop(void) 132
133void _eina_thread_setcanceltype(int type, int *oldtype)
133{ 134{
134 struct sched_param param; 135 pthread_setcanceltype(EINA_THREAD_CANCEL_DEFERRED, &oldtype);
135 int pol, ret; 136}
136 Eina_Thread pthread_id; 137int _eina_thread_setcancelstate(int type, int *oldtype)
137 138{
138 pthread_id = eina_thread_self(); 139 return pthread_setcancelstate(type, &oldtype);
139 ret = pthread_getschedparam(pthread_id, &pol, &param); 140}
140 if (ret) 141EAPI Eina_Bool
141 { 142_eina_thread_cancellable_set(Eina_Bool cancellable, Eina_Bool *was_cancellable)
142 EINA_LOG_ERR("Unable to query sched parameters"); 143{
143 return; 144 int state = cancellable ? EINA_THREAD_CANCEL_ENABLE : EINA_THREAD_CANCEL_DISABLE;
144 } 145 int old = 0;
145 146 int r;
146 if (EINA_UNLIKELY(pol == SCHED_RR || pol == SCHED_FIFO)) 147
147 { 148 /* enforce deferred in case users changed to asynchronous themselves */
148 param.sched_priority -= RTNICENESS; 149
149 150 _eina_thread_setcanceltype(EINA_THREAD_CANCEL_DEFERRED, &old);
150 /* We don't change the policy */ 151
151 if (param.sched_priority < 1) 152 r = _eina_thread_setcancelstate(state, &old);
152 { 153 if (was_cancellable && r == 0)
153 EINA_LOG_INFO("RT prio < 1, setting to 1 instead"); 154 *was_cancellable = (old == EINA_THREAD_CANCEL_ENABLE);
154 param.sched_priority = 1; 155 return r == 0;
155 } 156}
156 157void _eina_thread_cancel_checkpoint(){
157 pthread_setschedparam(pthread_id, pol, &param); 158 pthread_testcancel();
158 }
159 else
160 {
161 int prio;
162 errno = 0;
163 prio = getpriority(PRIO_PROCESS, 0);
164 if (errno == 0)
165 {
166 prio += NICENESS;
167 if (prio > 19)
168 {
169 EINA_LOG_INFO("Max niceness reached; keeping max (19)");
170 prio = 19;
171 }
172
173 setpriority(PRIO_PROCESS, 0, prio);
174 }
175 }
176} \ No newline at end of file 159} \ No newline at end of file
diff --git a/src/lib/eina/eina_thread_win32.c b/src/lib/eina/eina_thread_win32.c
index d274cba394..40b019ee23 100644
--- a/src/lib/eina/eina_thread_win32.c
+++ b/src/lib/eina/eina_thread_win32.c
@@ -21,10 +21,8 @@
21#endif 21#endif
22 22
23#include <stdlib.h> 23#include <stdlib.h>
24
25#include "eina_config.h" 24#include "eina_config.h"
26#include "eina_lock.h" /* it will include pthread.h with proper flags */ 25#include "eina_lock.h"
27
28#include "eina_sched.h" 26#include "eina_sched.h"
29#include "eina_cpu.h" 27#include "eina_cpu.h"
30#include "eina_thread.h" 28#include "eina_thread.h"
@@ -37,16 +35,9 @@
37#define WIN32_LEAN_AND_MEAN 35#define WIN32_LEAN_AND_MEAN
38#endif 36#endif
39#include <Windows.h> 37#include <Windows.h>
40
41#include <errno.h> 38#include <errno.h>
42#include <string.h> 39#include <string.h>
43 40
44#if defined(EINA_HAVE_PTHREAD_AFFINITY) || defined(EINA_HAVE_PTHREAD_SETNAME)
45#ifndef __linux__
46#define cpu_set_t cpuset_t
47#endif
48#endif
49
50typedef struct _Eina_win32_thread_func 41typedef struct _Eina_win32_thread_func
51{ 42{
52 void *data; 43 void *data;
@@ -86,12 +77,16 @@ void _eina_thread_set_priority(Eina_Thread_Priority prio, Eina_Thread *t)
86 { 77 {
87 case EINA_THREAD_URGENT: 78 case EINA_THREAD_URGENT:
88 nPriority = THREAD_PRIORITY_HIGHEST; 79 nPriority = THREAD_PRIORITY_HIGHEST;
80 break;
89 case EINA_THREAD_NORMAL: 81 case EINA_THREAD_NORMAL:
90 nPriority = THREAD_PRIORITY_NORMAL; 82 nPriority = THREAD_PRIORITY_NORMAL;
83 break;
91 case EINA_THREAD_BACKGROUND: 84 case EINA_THREAD_BACKGROUND:
92 nPriority = THREAD_PRIORITY_BELOW_NORMAL; 85 nPriority = THREAD_PRIORITY_BELOW_NORMAL;
86 break;
93 case EINA_THREAD_IDLE: 87 case EINA_THREAD_IDLE:
94 nPriority = THREAD_PRIORITY_IDLE; 88 nPriority = THREAD_PRIORITY_IDLE;
89 break;
95 } 90 }
96 91
97 SetThreadPriority((HANDLE)*t, nPriority); 92 SetThreadPriority((HANDLE)*t, nPriority);
@@ -130,14 +125,7 @@ _eina_thread_create(Eina_Thread *t, int affinity, void *(*func)(void *data), voi
130 125
131 if (affinity >= 0 && ret) 126 if (affinity >= 0 && ret)
132 { 127 {
133#ifdef EINA_HAVE_PTHREAD_AFFINITY
134 cpu_set_t cpu;
135 CPU_ZERO(&cpu);
136 CPU_SET(affinity, &cpu);
137 SetThreadAffinityMask(*t, (DWORD_PTR *)&cpu);
138#else
139 SetThreadAffinityMask(*t, (DWORD_PTR *)&affinity); 128 SetThreadAffinityMask(*t, (DWORD_PTR *)&affinity);
140#endif
141 } 129 }
142 130
143 return ret; 131 return ret;
@@ -158,7 +146,7 @@ _eina_thread_self(void)
158 return (Eina_Thread)GetCurrentThread(); 146 return (Eina_Thread)GetCurrentThread();
159} 147}
160 148
161Eina_Bool _eina_thread_set_name(Eina_Thread thread, char *buf) 149Eina_Bool _eina_thread_name_set(Eina_Thread thread, char *buf)
162{ 150{
163 HRESULT res = SetThreadDescription((HANDLE)thread, (PCWSTR)buf); 151 HRESULT res = SetThreadDescription((HANDLE)thread, (PCWSTR)buf);
164 return HRESULT_CODE(res); 152 return HRESULT_CODE(res);
@@ -171,44 +159,30 @@ Eina_Bool _eina_thread_cancel(Eina_Thread thread)
171 ExitThread(*lpExitCode); 159 ExitThread(*lpExitCode);
172 return !success; 160 return !success;
173} 161}
174 162void _eina_thread_setcanceltype(int type, int *oldtype)
175inline void _eina_sched_prio_drop(void)
176{ 163{
177 Eina_Thread pthread_id; 164 pthread_setcanceltype(EINA_THREAD_CANCEL_DEFERRED, &oldtype);
178 int sched_priority; 165}
179 166int _eina_thread_setcancelstate(int type, int *oldtype)
180 pthread_id = eina_thread_self(); 167{
181 168 return pthread_setcancelstate(type, &oldtype);
182 sched_priority = GetThreadPriority((HANDLE)pthread_id); 169}
183 170EAPI Eina_Bool
184 if (EINA_UNLIKELY(sched_priority == THREAD_PRIORITY_TIME_CRITICAL)) 171_eina_thread_cancellable_set(Eina_Bool cancellable, Eina_Bool *was_cancellable)
172{
173 int state = cancellable ? EINA_THREAD_CANCEL_ENABLE : EINA_THREAD_CANCEL_DISABLE;
174 if (!state)
185 { 175 {
186 sched_priority -= RTNICENESS; 176 *was_cancellable = EINA_TRUE;
187 177 return EINA_FALSE;
188 /* We don't change the policy */
189 if (sched_priority < 1)
190 {
191 EINA_LOG_INFO("RT prio < 1, setting to 1 instead");
192 sched_priority = 1;
193 }
194 if (!SetThreadPriority((HANDLE)pthread_id, sched_priority))
195 {
196 EINA_LOG_ERR("Unable to query sched parameters");
197 }
198 } 178 }
199 else 179 else
200 { 180 {
201 sched_priority += NICENESS; 181 *was_cancellable = EINA_TRUE;
202 182 return EINA_TRUE;
203 /* We don't change the policy */
204 if (sched_priority > THREAD_PRIORITY_TIME_CRITICAL)
205 {
206 EINA_LOG_INFO("Max niceness reached; keeping max (THREAD_PRIORITY_TIME_CRITICAL)");
207 sched_priority = THREAD_PRIORITY_TIME_CRITICAL;
208 }
209 if (!SetThreadPriority((HANDLE)pthread_id, sched_priority))
210 {
211 EINA_LOG_ERR("Unable to query sched parameters");
212 }
213 } 183 }
214} 184}
185void _eina_thread_cancel_checkpoint(void)
186{
187 pthread_testcancel();
188} \ No newline at end of file
diff --git a/src/lib/eina/meson.build b/src/lib/eina/meson.build
index 0b3b495bd1..3abcf48b27 100644
--- a/src/lib/eina/meson.build
+++ b/src/lib/eina/meson.build
@@ -200,11 +200,11 @@ sources = [
200if sys_windows == true 200if sys_windows == true
201 sources += 'eina_file_win32.c' 201 sources += 'eina_file_win32.c'
202 sources += 'eina_thread_win32.c' 202 sources += 'eina_thread_win32.c'
203 sources += 'eina_lock_win32.c' 203 sources += 'eina_sched_win32.c'
204else 204else
205 sources += 'eina_file.c' 205 sources += 'eina_file.c'
206 sources += 'eina_thread_posix.c' 206 sources += 'eina_thread_posix.c'
207 sources += 'eina_lock_posix.c' 207 sources += 'eina_sched_posix.c'
208endif 208endif
209 209
210eina_config = configuration_data() 210eina_config = configuration_data()
diff --git a/src/lib/evil/unposix/pthread.h b/src/lib/evil/unposix/pthread.h
index 0094c8b224..7790821c8d 100644
--- a/src/lib/evil/unposix/pthread.h
+++ b/src/lib/evil/unposix/pthread.h
@@ -89,6 +89,60 @@ UNIMPLEMENTED inline int pthread_cond_signal(void* c)
89 return 0; 89 return 0;
90} 90}
91 91
92UNIMPLEMENTED inline int pthread_rwlock_init(void* a, ...)
93{
94 #warning pthread_rwlock_init is not implemented.
95 return 0;
96}
97
98UNIMPLEMENTED inline int pthread_mutexattr_settype(void* a, ...)
99{
100 #warning pthread_mutexattr_settype is not implemented.
101 return 0;
102}
103
104UNIMPLEMENTED inline int pthread_mutex_init(void* a, ...)
105{
106 #warning pthread_mutex_init is not implemented.
107 return 0;
108}
109
110UNIMPLEMENTED inline int pthread_mutex_destroy(void* a, ...)
111{
112 #warning pthread_mutex_destroy is not implemented.
113 return 0;
114}
115
116UNIMPLEMENTED inline int pthread_condattr_init(void* a, ...)
117{
118 #warning pthread_condattr_init is not implemented.
119 return 0;
120}
121
122UNIMPLEMENTED inline int pthread_cond_init(void* a, ...)
123{
124 #warning pthread_cond_init is not implemented.
125 return 0;
126}
127
128UNIMPLEMENTED inline int pthread_condattr_destroy(void* a, ...)
129{
130 #warning pthread_condattr_destroy is not implemented.
131 return 0;
132}
133
134UNIMPLEMENTED inline int pthread_cond_destroy(void* a, ...)
135{
136 #warning pthread_cond_destroy is not implemented.
137 return 0;
138}
139
140UNIMPLEMENTED inline int pthread_rwlock_destroy(void* a, ...)
141{
142 #warning pthread_rwlock_destroy is not implemented.
143 return 0;
144}
145
92UNIMPLEMENTED inline int pthread_rwlock_rdlock(void* c) 146UNIMPLEMENTED inline int pthread_rwlock_rdlock(void* c)
93{ 147{
94 #warning pthread_rwlock_rdlock is not implemented. 148 #warning pthread_rwlock_rdlock is not implemented.