1 module mutils.bindings.pthreads_windows; 2 3 import core.stdc.time; 4 5 version (Windows) : extern (C): 6 // From header file: ftp://sourceware.org/pub/pthreads-win32/dll-latest/include/ 7 8 struct pthread_t { 9 void* p; 10 uint x; 11 } 12 13 alias pthread_mutex_t = void*; 14 alias pthread_attr_t = void*; 15 alias pthread_cond_t = void*; 16 alias pthread_condattr_t = void*; 17 alias pthread_mutexattr_t = void*; 18 alias pthread_rwlock_t = void*; 19 alias pthread_key_t = void*; 20 alias pthread_rwlockattr_t = void*; 21 //pthread_attr_t 22 struct sched_param { 23 int sched_priority; 24 } 25 26 struct timespec { 27 time_t a; 28 int b; 29 } 30 31 struct pthread_once_t { 32 int done; /* indicates if user function has been executed */ 33 void* lock; 34 int reserved1; 35 int reserved2; 36 } 37 38 int pthread_atfork(void function(), void function(), void function()); 39 int pthread_attr_destroy(pthread_attr_t*); 40 int pthread_attr_getdetachstate(in pthread_attr_t*, int*); 41 int pthread_attr_getschedparam(in pthread_attr_t*, sched_param*); 42 int pthread_attr_init(pthread_attr_t*); 43 int pthread_attr_setdetachstate(pthread_attr_t*, int); 44 int pthread_attr_setschedparam(in pthread_attr_t*, sched_param*); 45 int pthread_cancel(pthread_t); 46 void pthread_cleanup_push(void function(void*), void*); 47 void pthread_cleanup_pop(int); 48 int pthread_cond_broadcast(pthread_cond_t*); 49 int pthread_cond_destroy(pthread_cond_t*); 50 int pthread_cond_init(in pthread_cond_t*, pthread_condattr_t*); 51 int pthread_cond_signal(pthread_cond_t*); 52 int pthread_cond_timedwait(pthread_cond_t*, pthread_mutex_t*, in timespec*); 53 int pthread_cond_wait(pthread_cond_t*, pthread_mutex_t*); 54 int pthread_condattr_destroy(pthread_condattr_t*); 55 int pthread_condattr_init(pthread_condattr_t*); 56 int pthread_create(pthread_t*, in pthread_attr_t*, void* function(void*), void*); 57 int pthread_detach(pthread_t); 58 int pthread_equal(pthread_t, pthread_t); 59 void pthread_exit(void*); 60 void* pthread_getspecific(pthread_key_t); 61 int pthread_join(pthread_t, void**); 62 int pthread_key_create(pthread_key_t*, void function(void*)); 63 int pthread_key_delete(pthread_key_t); 64 int pthread_mutex_destroy(pthread_mutex_t*); 65 int pthread_mutex_init(pthread_mutex_t*, pthread_mutexattr_t*); 66 int pthread_mutex_lock(pthread_mutex_t*); 67 int pthread_mutex_trylock(pthread_mutex_t*); 68 int pthread_mutex_unlock(pthread_mutex_t*); 69 int pthread_mutexattr_destroy(pthread_mutexattr_t*); 70 int pthread_mutexattr_init(pthread_mutexattr_t*); 71 int pthread_once(pthread_once_t*, void function()); 72 int pthread_rwlock_destroy(pthread_rwlock_t*); 73 int pthread_rwlock_init(pthread_rwlock_t*, in pthread_rwlockattr_t*); 74 int pthread_rwlock_rdlock(pthread_rwlock_t*); 75 int pthread_rwlock_tryrdlock(pthread_rwlock_t*); 76 int pthread_rwlock_trywrlock(pthread_rwlock_t*); 77 int pthread_rwlock_unlock(pthread_rwlock_t*); 78 int pthread_rwlock_wrlock(pthread_rwlock_t*); 79 int pthread_rwlockattr_destroy(pthread_rwlockattr_t*); 80 int pthread_rwlockattr_init(pthread_rwlockattr_t*); 81 pthread_t pthread_self(); 82 int pthread_setcancelstate(int, int*); 83 int pthread_setcanceltype(int, int*); 84 int pthread_setspecific(pthread_key_t, in void*); 85 void pthread_testcancel(); 86 87 88 89 90 91 // semaphore.h 92 93 alias sem_t = void*; 94 95 int sem_init(sem_t*, int, uint); 96 int sem_wait(sem_t*); 97 int sem_trywait(sem_t*); 98 int sem_post(sem_t*); 99 int sem_destroy(sem_t*); 100 101 // sched.h 102 103 int sched_yield();