Make UEFI boot-platform build again
[haiku.git] / headers / private / libroot / pthread_private.h
blob953315b60c6fa306f328ed762e6c02e3809bbe64
1 /*
2 * Copyright 2003-2009, Axel Dörfler, axeld@pinc-software.de.
3 * Copyright 2007, Ryan Leavengood, leavengood@gmail.com.
4 * All rights reserved. Distributed under the terms of the MIT License.
5 */
6 #ifndef _PTHREAD_PRIVATE_H_
7 #define _PTHREAD_PRIVATE_H_
10 #include <pthread.h>
12 #include <OS.h>
15 // _pthread_thread::flags values
16 #define THREAD_DETACHED 0x01
17 #define THREAD_DEAD 0x02
18 #define THREAD_CANCELED 0x04
19 #define THREAD_CANCEL_ENABLED 0x08
20 #define THREAD_CANCEL_ASYNCHRONOUS 0x10
23 struct thread_creation_attributes;
25 // The public *_t types are only pointers to these structures
26 // This way, we are completely free to change them, which might be
27 // necessary in the future (not only due to the incomplete implementation
28 // at this point).
30 typedef struct _pthread_condattr {
31 bool process_shared;
32 clockid_t clock_id;
33 } pthread_condattr;
35 typedef struct _pthread_mutexattr {
36 int32 type;
37 bool process_shared;
38 } pthread_mutexattr;
40 typedef struct _pthread_barrierattr {
41 bool process_shared;
42 } pthread_barrierattr;
44 typedef struct _pthread_attr {
45 int32 detach_state;
46 int32 sched_priority;
47 size_t stack_size;
48 size_t guard_size;
49 } pthread_attr;
51 typedef struct _pthread_rwlockattr {
52 uint32_t flags;
53 } pthread_rwlockattr;
55 typedef void (*pthread_key_destructor)(void *data);
57 struct pthread_key {
58 int32 sequence;
59 pthread_key_destructor destructor;
62 struct pthread_key_data {
63 int32 sequence;
64 void *value;
67 #define PTHREAD_UNUSED_SEQUENCE 0
69 typedef struct _pthread_thread {
70 thread_id id;
71 int32 flags;
72 void *(*entry)(void*);
73 void *entry_argument;
74 void *exit_value;
75 struct pthread_key_data specific[PTHREAD_KEYS_MAX];
76 struct __pthread_cleanup_handler *cleanup_handlers;
77 } pthread_thread;
80 #ifdef __cplusplus
81 extern "C" {
82 #endif
84 void __pthread_key_call_destructors(pthread_thread *thread);
85 void __pthread_destroy_thread(void);
86 pthread_thread *__allocate_pthread(void* (*entry)(void*), void *data);
87 void __init_pthread(pthread_thread* thread, void* (*entry)(void*), void* data);
88 status_t __pthread_init_creation_attributes(
89 const pthread_attr_t* pthreadAttributes, pthread_t thread,
90 status_t (*entryFunction)(void*, void*), void* argument1,
91 void* argument2, const char* name,
92 struct thread_creation_attributes* attributes);
94 #ifdef __cplusplus
96 #endif
98 #endif /* _PTHREAD_PRIVATE_H_ */