blob: 9946d51163ab6eb954a9c83feec5b5fc1fdf0255 [file] [log] [blame]
Christopher Faulet1a2b56e2017-10-12 16:09:09 +02001/*
2 * include/common/hathreads.h
3 * definitions, macros and inline functions about threads.
4 *
5 * Copyright (C) 2017 Christopher Fauet - cfaulet@haproxy.com
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation, version 2.1
10 * exclusively.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22#ifndef _COMMON_HATHREADS_H
23#define _COMMON_HATHREADS_H
24
25#include <common/config.h>
26
27#define MAX_THREADS_MASK ((unsigned long)-1)
28extern THREAD_LOCAL unsigned int tid; /* The thread id */
29extern THREAD_LOCAL unsigned int tid_bit; /* The bit corresponding to the thread id */
30
31#ifndef USE_THREAD
32
33#define HA_ATOMIC_CAS(val, old, new) ({((*val) == (*old)) ? (*(val) = (new) , 1) : (*(old) = *(val), 0);})
34#define HA_ATOMIC_ADD(val, i) ({*(val) += (i);})
35#define HA_ATOMIC_SUB(val, i) ({*(val) -= (i);})
36#define HA_ATOMIC_AND(val, flags) ({*(val) &= (flags);})
37#define HA_ATOMIC_OR(val, flags) ({*(val) |= (flags);})
38#define HA_ATOMIC_XCHG(val, new) \
39 ({ \
40 typeof(*(val)) __old = *(val); \
41 *(val) = new; \
42 __old; \
43 })
44#define HA_ATOMIC_STORE(val, new) ({*(val) = new;})
45#define HA_ATOMIC_UPDATE_MAX(val, new) \
46 ({ \
47 typeof(*(val)) __new = (new); \
48 \
49 if (*(val) < __new) \
50 *(val) = __new; \
51 *(val); \
52 })
53
54#define HA_ATOMIC_UPDATE_MIN(val, new) \
55 ({ \
56 typeof(*(val)) __new = (new); \
57 \
58 if (*(val) > __new) \
59 *(val) = __new; \
60 *(val); \
61 })
62
Christopher Faulet339fff82017-10-19 11:59:15 +020063
64#define THREAD_SYNC_INIT(m) do { /* do nothing */ } while(0)
65#define THREAD_SYNC_ENABLE() do { /* do nothing */ } while(0)
66#define THREAD_WANT_SYNC() do { /* do nothing */ } while(0)
67#define THREAD_ENTER_SYNC() do { /* do nothing */ } while(0)
68#define THREAD_EXIT_SYNC() do { /* do nothing */ } while(0)
69#define THREAD_NO_SYNC() ({ 0; })
70#define THREAD_NEED_SYNC() ({ 1; })
71
Christopher Faulet1a2b56e2017-10-12 16:09:09 +020072#define SPIN_INIT(l) do { /* do nothing */ } while(0)
73#define SPIN_DESTROY(l) do { /* do nothing */ } while(0)
74#define SPIN_LOCK(lbl, l) do { /* do nothing */ } while(0)
75#define SPIN_TRYLOCK(lbl, l) ({ 0; })
76#define SPIN_UNLOCK(lbl, l) do { /* do nothing */ } while(0)
77
78#define RWLOCK_INIT(l) do { /* do nothing */ } while(0)
79#define RWLOCK_DESTROY(l) do { /* do nothing */ } while(0)
80#define RWLOCK_WRLOCK(lbl, l) do { /* do nothing */ } while(0)
81#define RWLOCK_TRYWRLOCK(lbl, l) ({ 0; })
82#define RWLOCK_WRUNLOCK(lbl, l) do { /* do nothing */ } while(0)
83#define RWLOCK_RDLOCK(lbl, l) do { /* do nothing */ } while(0)
84#define RWLOCK_TRYRDLOCK(lbl, l) ({ 0; })
85#define RWLOCK_RDUNLOCK(lbl, l) do { /* do nothing */ } while(0)
86
87#else /* USE_THREAD */
88
89#include <stdio.h>
90#include <stdlib.h>
91#include <string.h>
92#include <pthread.h>
93#include <import/plock.h>
94
95/* TODO: thread: For now, we rely on GCC builtins but it could be a good idea to
96 * have a header file regrouping all functions dealing with threads. */
97#define HA_ATOMIC_CAS(val, old, new) __atomic_compare_exchange_n(val, old, new, 0, 0, 0)
98#define HA_ATOMIC_ADD(val, i) __atomic_add_fetch(val, i, 0)
99#define HA_ATOMIC_SUB(val, i) __atomic_sub_fetch(val, i, 0)
100#define HA_ATOMIC_AND(val, flags) __atomic_and_fetch(val, flags, 0)
101#define HA_ATOMIC_OR(val, flags) __atomic_or_fetch(val, flags, 0)
102#define HA_ATOMIC_XCHG(val, new) __atomic_exchange_n(val, new, 0)
103#define HA_ATOMIC_STORE(val, new) __atomic_store_n(val, new, 0)
104#define HA_ATOMIC_UPDATE_MAX(val, new) \
105 ({ \
106 typeof(*(val)) __old = *(val); \
107 typeof(*(val)) __new = (new); \
108 \
109 while (__old < __new && !HA_ATOMIC_CAS(val, &__old, __new)); \
110 (*val); \
111 })
112#define HA_ATOMIC_UPDATE_MIN(val, new) \
113 ({ \
114 typeof((*val)) __old = *(val); \
115 typeof((*val)) __new = (new); \
116 \
117 while (__old > __new && !HA_ATOMIC_CAS(val, &__old, __new)); \
118 (*val); \
119 })
120
Christopher Faulet339fff82017-10-19 11:59:15 +0200121#define THREAD_SYNC_INIT(m) thread_sync_init(m)
122#define THREAD_SYNC_ENABLE() thread_sync_enable()
123#define THREAD_WANT_SYNC() thread_want_sync()
124#define THREAD_ENTER_SYNC() thread_enter_sync()
125#define THREAD_EXIT_SYNC() thread_exit_sync()
126#define THREAD_NO_SYNC() thread_no_sync()
127#define THREAD_NEED_SYNC() thread_need_sync()
128
129int thread_sync_init(unsigned long mask);
130void thread_sync_enable(void);
131void thread_want_sync(void);
132void thread_enter_sync(void);
133void thread_exit_sync(void);
134int thread_no_sync(void);
135int thread_need_sync(void);
136
Christopher Faulet1a2b56e2017-10-12 16:09:09 +0200137#if defined(DEBUG_THREAD) || defined(DEBUG_FULL)
138
139enum lock_label {
Christopher Faulet339fff82017-10-19 11:59:15 +0200140 THREAD_SYNC_LOCK = 0,
Christopher Fauletd4604ad2017-05-29 10:40:41 +0200141 FDTAB_LOCK,
142 FDCACHE_LOCK,
143 FD_LOCK,
144 POLL_LOCK,
Emeric Brunc60def82017-09-27 14:59:38 +0200145 TASK_RQ_LOCK,
146 TASK_WQ_LOCK,
Christopher Fauletb349e482017-08-29 09:52:38 +0200147 POOL_LOCK,
Christopher Faulet8d8aa0d2017-05-30 15:36:50 +0200148 LISTENER_LOCK,
149 LISTENER_QUEUE_LOCK,
Christopher Fauletff8abcd2017-06-02 15:33:24 +0200150 PROXY_LOCK,
Christopher Faulet29f77e82017-06-08 14:04:45 +0200151 SERVER_LOCK,
Christopher Faulet5d42e092017-10-16 12:00:40 +0200152 UPDATED_SERVERS_LOCK,
Christopher Faulet5b517552017-06-09 14:17:53 +0200153 LBPRM_LOCK,
Christopher Fauletb79a94c2017-05-30 15:34:30 +0200154 SIGNALS_LOCK,
Christopher Faulet339fff82017-10-19 11:59:15 +0200155 LOCK_LABELS
Christopher Faulet1a2b56e2017-10-12 16:09:09 +0200156};
157struct lock_stat {
158 uint64_t nsec_wait_for_write;
159 uint64_t nsec_wait_for_read;
160 uint64_t num_write_locked;
161 uint64_t num_write_unlocked;
162 uint64_t num_read_locked;
163 uint64_t num_read_unlocked;
164};
165
166extern struct lock_stat lock_stats[LOCK_LABELS];
167
168#define __HA_SPINLOCK_T unsigned long
169
170#define __SPIN_INIT(l) ({ (*l) = 0; })
171#define __SPIN_DESTROY(l) ({ (*l) = 0; })
172#define __SPIN_LOCK(l) pl_take_w(l)
173#define __SPIN_TRYLOCK(l) !pl_try_w(l)
174#define __SPIN_UNLOCK(l) pl_drop_w(l)
175
176#define __HA_RWLOCK_T unsigned long
177
178#define __RWLOCK_INIT(l) ({ (*l) = 0; })
179#define __RWLOCK_DESTROY(l) ({ (*l) = 0; })
180#define __RWLOCK_WRLOCK(l) pl_take_w(l)
181#define __RWLOCK_TRYWRLOCK(l) !pl_try_w(l)
182#define __RWLOCK_WRUNLOCK(l) pl_drop_w(l)
183#define __RWLOCK_RDLOCK(l) pl_take_r(l)
184#define __RWLOCK_TRYRDLOCK(l) !pl_try_r(l)
185#define __RWLOCK_RDUNLOCK(l) pl_drop_r(l)
186
187#define HA_SPINLOCK_T struct ha_spinlock
188
189#define SPIN_INIT(l) __spin_init(l)
190#define SPIN_DESTROY(l) __spin_destroy(l)
191
192#define SPIN_LOCK(lbl, l) __spin_lock(lbl, l, __func__, __FILE__, __LINE__)
193#define SPIN_TRYLOCK(lbl, l) __spin_trylock(lbl, l, __func__, __FILE__, __LINE__)
194#define SPIN_UNLOCK(lbl, l) __spin_unlock(lbl, l, __func__, __FILE__, __LINE__)
195
196#define HA_RWLOCK_T struct ha_rwlock
197
198#define RWLOCK_INIT(l) __ha_rwlock_init((l))
199#define RWLOCK_DESTROY(l) __ha_rwlock_destroy((l))
200#define RWLOCK_WRLOCK(lbl,l) __ha_rwlock_wrlock(lbl, l, __func__, __FILE__, __LINE__)
201#define RWLOCK_TRYWRLOCK(lbl,l) __ha_rwlock_trywrlock(lbl, l, __func__, __FILE__, __LINE__)
202#define RWLOCK_WRUNLOCK(lbl,l) __ha_rwlock_wrunlock(lbl, l, __func__, __FILE__, __LINE__)
203#define RWLOCK_RDLOCK(lbl,l) __ha_rwlock_rdlock(lbl, l)
204#define RWLOCK_TRYRDLOCK(lbl,l) __ha_rwlock_tryrdlock(lbl, l)
205#define RWLOCK_RDUNLOCK(lbl,l) __ha_rwlock_rdunlock(lbl, l)
206
207struct ha_spinlock {
208 __HA_SPINLOCK_T lock;
209 struct {
210 unsigned long owner; /* a bit is set to 1 << tid for the lock owner */
211 unsigned long waiters; /* a bit is set to 1 << tid for waiting threads */
212 struct {
213 const char *function;
214 const char *file;
215 int line;
216 } last_location; /* location of the last owner */
217 } info;
218};
219
220struct ha_rwlock {
221 __HA_RWLOCK_T lock;
222 struct {
223 unsigned long cur_writer; /* a bit is set to 1 << tid for the lock owner */
224 unsigned long wait_writers; /* a bit is set to 1 << tid for waiting writers */
225 unsigned long cur_readers; /* a bit is set to 1 << tid for current readers */
226 unsigned long wait_readers; /* a bit is set to 1 << tid for waiting waiters */
227 struct {
228 const char *function;
229 const char *file;
230 int line;
231 } last_location; /* location of the last write owner */
232 } info;
233};
234
235static inline void show_lock_stats()
236{
Christopher Fauletd4604ad2017-05-29 10:40:41 +0200237 const char *labels[LOCK_LABELS] = {"THREAD_SYNC", "FDTAB", "FDCACHE", "FD", "POLL",
Christopher Fauletb79a94c2017-05-30 15:34:30 +0200238 "TASK_RQ", "TASK_WQ", "POOL",
Christopher Faulet29f77e82017-06-08 14:04:45 +0200239 "LISTENER", "LISTENER_QUEUE", "PROXY", "SERVER",
Christopher Faulet5b517552017-06-09 14:17:53 +0200240 "UPDATED_SERVERS", "LBPRM", "SIGNALS" };
Christopher Faulet1a2b56e2017-10-12 16:09:09 +0200241 int lbl;
242
243 for (lbl = 0; lbl < LOCK_LABELS; lbl++) {
244 fprintf(stderr,
245 "Stats about Lock %s: \n"
246 "\t # write lock : %lu\n"
247 "\t # write unlock: %lu (%ld)\n"
248 "\t # wait time for write : %.3f msec\n"
249 "\t # wait time for write/lock: %.3f nsec\n"
250 "\t # read lock : %lu\n"
251 "\t # read unlock : %lu (%ld)\n"
252 "\t # wait time for read : %.3f msec\n"
253 "\t # wait time for read/lock : %.3f nsec\n",
254 labels[lbl],
255 lock_stats[lbl].num_write_locked,
256 lock_stats[lbl].num_write_unlocked,
257 lock_stats[lbl].num_write_unlocked - lock_stats[lbl].num_write_locked,
258 (double)lock_stats[lbl].nsec_wait_for_write / 1000000.0,
259 lock_stats[lbl].num_write_locked ? ((double)lock_stats[lbl].nsec_wait_for_write / (double)lock_stats[lbl].num_write_locked) : 0,
260 lock_stats[lbl].num_read_locked,
261 lock_stats[lbl].num_read_unlocked,
262 lock_stats[lbl].num_read_unlocked - lock_stats[lbl].num_read_locked,
263 (double)lock_stats[lbl].nsec_wait_for_read / 1000000.0,
264 lock_stats[lbl].num_read_locked ? ((double)lock_stats[lbl].nsec_wait_for_read / (double)lock_stats[lbl].num_read_locked) : 0);
265 }
266}
267
268/* Following functions are used to collect some stats about locks. We wrap
269 * pthread functions to known how much time we wait in a lock. */
270
271static uint64_t nsec_now(void) {
272 struct timespec ts;
273
274 clock_gettime(CLOCK_MONOTONIC, &ts);
275 return ((uint64_t) ts.tv_sec * 1000000000ULL +
276 (uint64_t) ts.tv_nsec);
277}
278
279static inline void __ha_rwlock_init(struct ha_rwlock *l)
280{
281 memset(l, 0, sizeof(struct ha_rwlock));
282 __RWLOCK_INIT(&l->lock);
283}
284
285static inline void __ha_rwlock_destroy(struct ha_rwlock *l)
286{
287 __RWLOCK_DESTROY(&l->lock);
288 memset(l, 0, sizeof(struct ha_rwlock));
289}
290
291
292static inline void __ha_rwlock_wrlock(enum lock_label lbl, struct ha_rwlock *l,
293 const char *func, const char *file, int line)
294{
295 uint64_t start_time;
296
297 if (unlikely(l->info.cur_writer & tid_bit)) {
298 /* the thread is already owning the lock for write */
299 abort();
300 }
301
302 if (unlikely(l->info.cur_readers & tid_bit)) {
303 /* the thread is already owning the lock for read */
304 abort();
305 }
306
307 HA_ATOMIC_OR(&l->info.wait_writers, tid_bit);
308
309 start_time = nsec_now();
310 __RWLOCK_WRLOCK(&l->lock);
311 HA_ATOMIC_ADD(&lock_stats[lbl].nsec_wait_for_write, (nsec_now() - start_time));
312
313 HA_ATOMIC_ADD(&lock_stats[lbl].num_write_locked, 1);
314
315 l->info.cur_writer = tid_bit;
316 l->info.last_location.function = func;
317 l->info.last_location.file = file;
318 l->info.last_location.line = line;
319
320 HA_ATOMIC_AND(&l->info.wait_writers, ~tid_bit);
321}
322
323static inline int __ha_rwlock_trywrlock(enum lock_label lbl, struct ha_rwlock *l,
324 const char *func, const char *file, int line)
325{
326 uint64_t start_time;
327 int r;
328
329 if (unlikely(l->info.cur_writer & tid_bit)) {
330 /* the thread is already owning the lock for write */
331 abort();
332 }
333
334 if (unlikely(l->info.cur_readers & tid_bit)) {
335 /* the thread is already owning the lock for read */
336 abort();
337 }
338
339 /* We set waiting writer because trywrlock could wait for readers to quit */
340 HA_ATOMIC_OR(&l->info.wait_writers, tid_bit);
341
342 start_time = nsec_now();
343 r = __RWLOCK_TRYWRLOCK(&l->lock);
344 HA_ATOMIC_ADD(&lock_stats[lbl].nsec_wait_for_write, (nsec_now() - start_time));
345 if (unlikely(r)) {
346 HA_ATOMIC_AND(&l->info.wait_writers, ~tid_bit);
347 return r;
348 }
349 HA_ATOMIC_ADD(&lock_stats[lbl].num_write_locked, 1);
350
351 l->info.cur_writer = tid_bit;
352 l->info.last_location.function = func;
353 l->info.last_location.file = file;
354 l->info.last_location.line = line;
355
356 HA_ATOMIC_AND(&l->info.wait_writers, ~tid_bit);
357
358 return 0;
359}
360
361static inline void __ha_rwlock_wrunlock(enum lock_label lbl,struct ha_rwlock *l,
362 const char *func, const char *file, int line)
363{
364 if (unlikely(!(l->info.cur_writer & tid_bit))) {
365 /* the thread is not owning the lock for write */
366 abort();
367 }
368
369 l->info.cur_writer = 0;
370 l->info.last_location.function = func;
371 l->info.last_location.file = file;
372 l->info.last_location.line = line;
373
374 __RWLOCK_WRUNLOCK(&l->lock);
375
376 HA_ATOMIC_ADD(&lock_stats[lbl].num_write_unlocked, 1);
377}
378
379static inline void __ha_rwlock_rdlock(enum lock_label lbl,struct ha_rwlock *l)
380{
381 uint64_t start_time;
382
383 if (unlikely(l->info.cur_writer & tid_bit)) {
384 /* the thread is already owning the lock for write */
385 abort();
386 }
387
388 if (unlikely(l->info.cur_readers & tid_bit)) {
389 /* the thread is already owning the lock for read */
390 abort();
391 }
392
393 HA_ATOMIC_OR(&l->info.wait_readers, tid_bit);
394
395 start_time = nsec_now();
396 __RWLOCK_RDLOCK(&l->lock);
397 HA_ATOMIC_ADD(&lock_stats[lbl].nsec_wait_for_read, (nsec_now() - start_time));
398 HA_ATOMIC_ADD(&lock_stats[lbl].num_read_locked, 1);
399
400 HA_ATOMIC_OR(&l->info.cur_readers, tid_bit);
401
402 HA_ATOMIC_AND(&l->info.wait_readers, ~tid_bit);
403}
404
405static inline int __ha_rwlock_tryrdlock(enum lock_label lbl,struct ha_rwlock *l)
406{
407 int r;
408
409 if (unlikely(l->info.cur_writer & tid_bit)) {
410 /* the thread is already owning the lock for write */
411 abort();
412 }
413
414 if (unlikely(l->info.cur_readers & tid_bit)) {
415 /* the thread is already owning the lock for read */
416 abort();
417 }
418
419 /* try read should never wait */
420 r = __RWLOCK_TRYRDLOCK(&l->lock);
421 if (unlikely(r))
422 return r;
423 HA_ATOMIC_ADD(&lock_stats[lbl].num_read_locked, 1);
424
425 HA_ATOMIC_OR(&l->info.cur_readers, tid_bit);
426
427 return 0;
428}
429
430static inline void __ha_rwlock_rdunlock(enum lock_label lbl,struct ha_rwlock *l)
431{
432 if (unlikely(!(l->info.cur_readers & tid_bit))) {
433 /* the thread is not owning the lock for read */
434 abort();
435 }
436
437 HA_ATOMIC_AND(&l->info.cur_readers, ~tid_bit);
438
439 __RWLOCK_RDUNLOCK(&l->lock);
440
441 HA_ATOMIC_ADD(&lock_stats[lbl].num_read_unlocked, 1);
442}
443
444static inline void __spin_init(struct ha_spinlock *l)
445{
446 memset(l, 0, sizeof(struct ha_spinlock));
447 __SPIN_INIT(&l->lock);
448}
449
450static inline void __spin_destroy(struct ha_spinlock *l)
451{
452 __SPIN_DESTROY(&l->lock);
453 memset(l, 0, sizeof(struct ha_spinlock));
454}
455
456static inline void __spin_lock(enum lock_label lbl, struct ha_spinlock *l,
457 const char *func, const char *file, int line)
458{
459 uint64_t start_time;
460
461 if (unlikely(l->info.owner & tid_bit)) {
462 /* the thread is already owning the lock */
463 abort();
464 }
465
466 HA_ATOMIC_OR(&l->info.waiters, tid_bit);
467
468 start_time = nsec_now();
469 __SPIN_LOCK(&l->lock);
470 HA_ATOMIC_ADD(&lock_stats[lbl].nsec_wait_for_write, (nsec_now() - start_time));
471
472 HA_ATOMIC_ADD(&lock_stats[lbl].num_write_locked, 1);
473
474
475 l->info.owner = tid_bit;
476 l->info.last_location.function = func;
477 l->info.last_location.file = file;
478 l->info.last_location.line = line;
479
480 HA_ATOMIC_AND(&l->info.waiters, ~tid_bit);
481}
482
483static inline int __spin_trylock(enum lock_label lbl, struct ha_spinlock *l,
484 const char *func, const char *file, int line)
485{
486 int r;
487
488 if (unlikely(l->info.owner & tid_bit)) {
489 /* the thread is already owning the lock */
490 abort();
491 }
492
493 /* try read should never wait */
494 r = __SPIN_TRYLOCK(&l->lock);
495 if (unlikely(r))
496 return r;
497 HA_ATOMIC_ADD(&lock_stats[lbl].num_write_locked, 1);
498
499 l->info.owner = tid_bit;
500 l->info.last_location.function = func;
501 l->info.last_location.file = file;
502 l->info.last_location.line = line;
503
504 return 0;
505}
506
507static inline void __spin_unlock(enum lock_label lbl, struct ha_spinlock *l,
508 const char *func, const char *file, int line)
509{
510 if (unlikely(!(l->info.owner & tid_bit))) {
511 /* the thread is not owning the lock */
512 abort();
513 }
514
515 l->info.owner = 0;
516 l->info.last_location.function = func;
517 l->info.last_location.file = file;
518 l->info.last_location.line = line;
519
520 __RWLOCK_WRUNLOCK(&l->lock);
521
522 HA_ATOMIC_ADD(&lock_stats[lbl].num_write_unlocked, 1);
523}
524
525#else /* DEBUG_THREAD */
526
527#define HA_SPINLOCK_T unsigned long
528
529#define SPIN_INIT(l) ({ (*l) = 0; })
530#define SPIN_DESTROY(l) ({ (*l) = 0; })
531#define SPIN_LOCK(lbl, l) pl_take_w(l)
532#define SPIN_TRYLOCK(lbl, l) !pl_try_w(l)
533#define SPIN_UNLOCK(lbl, l) pl_drop_w(l)
534
535#define HA_RWLOCK_T unsigned long
536
537#define RWLOCK_INIT(l) ({ (*l) = 0; })
538#define RWLOCK_DESTROY(l) ({ (*l) = 0; })
539#define RWLOCK_WRLOCK(lbl,l) pl_take_w(l)
540#define RWLOCK_TRYWRLOCK(lbl,l) !pl_try_w(l)
541#define RWLOCK_WRUNLOCK(lbl,l) pl_drop_w(l)
542#define RWLOCK_RDLOCK(lbl,l) pl_take_r(l)
543#define RWLOCK_TRYRDLOCK(lbl,l) !pl_try_r(l)
544#define RWLOCK_RDUNLOCK(lbl,l) pl_drop_r(l)
545
546#endif /* DEBUG_THREAD */
547
548#endif /* USE_THREAD */
549
550#endif /* _COMMON_HATHREADS_H */