pthreads_cross.h
Go to the documentation of this file.
1 
23 #ifndef __CPTHREAD_H__
24 #define __CPTHREAD_H__
25 
26 #ifdef _WIN32
27 #include <stdbool.h>
28 #include <windows.h>
29 #else
30 #include <pthread.h>
31 #include <sched.h>
32 #endif
33 #include <time.h>
34 
35 #ifdef _WIN32
36 
37 typedef CRITICAL_SECTION pthread_mutex_t;
38 typedef void pthread_mutexattr_t;
39 typedef void pthread_attr_t;
40 typedef void pthread_condattr_t;
41 typedef void pthread_rwlockattr_t;
42 typedef HANDLE pthread_t;
43 typedef CONDITION_VARIABLE pthread_cond_t;
44 
45 #ifdef __cplusplus
46 extern "C" {
47 #endif
48 int pthread_create(pthread_t *thread, pthread_attr_t *attr, void *(*start_routine)(void *), void *arg);
49 int pthread_join(pthread_t thread, void **value_ptr);
50 int pthread_detach(pthread_t);
51 
52 int pthread_mutex_init(pthread_mutex_t *mutex, pthread_mutexattr_t *attr);
53 int pthread_mutex_destroy(pthread_mutex_t *mutex);
54 int pthread_mutex_lock(pthread_mutex_t *mutex);
55 int pthread_mutex_unlock(pthread_mutex_t *mutex);
56 
57 int pthread_cond_init(pthread_cond_t *cond, pthread_condattr_t *attr);
58 int pthread_cond_destroy(pthread_cond_t *cond);
59 int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex);
60 int pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex, const struct timespec *abstime);
61 int pthread_cond_signal(pthread_cond_t *cond);
62 int pthread_cond_broadcast(pthread_cond_t *cond);
63 
64 int sched_yield(void);
65 #ifdef __cplusplus
66 }
67 #endif
68 #endif
69 
70 
71 #ifdef __cplusplus
72 extern "C" {
73 #endif
74 unsigned int pcthread_get_num_procs();
75 
76 void ms_to_timespec(struct timespec *ts, unsigned int ms);
77 unsigned int timespec_to_ms(const struct timespec *abstime);
78 #ifdef __cplusplus
79 }
80 #endif
81 
82 #endif /* __CPTHREAD_H__ */
ms_to_timespec
void ms_to_timespec(struct timespec *ts, unsigned int ms)
timespec_to_ms
unsigned int timespec_to_ms(const struct timespec *abstime)
pcthread_get_num_procs
unsigned int pcthread_get_num_procs()
Definition: pthreads_cross.c:252


apriltag
Author(s): Edwin Olson , Max Krogius
autogenerated on Sun Apr 20 2025 02:08:19