3 #ifndef __CPROVER_PTHREAD_H_INCLUDED
5 #define __CPROVER_PTHREAD_H_INCLUDED
15 #ifdef __CPROVER_CUSTOM_BITVECTOR_ANALYSIS
16 if(type==PTHREAD_MUTEX_RECURSIVE)
28 #ifndef __CPROVER_PTHREAD_H_INCLUDED
30 #define __CPROVER_PTHREAD_H_INCLUDED
40 #ifdef __CPROVER_CUSTOM_BITVECTOR_ANALYSIS
42 "pthread_cancel must be given valid thread ID");
51 #ifndef __CPROVER_PTHREAD_H_INCLUDED
53 #define __CPROVER_PTHREAD_H_INCLUDED
56 #ifndef __CPROVER_mutex_t_defined
57 #define __CPROVER_mutex_t_defined
58 #if defined __CYGWIN__ || defined __MINGW32__ || defined _WIN32
66 #ifdef __CPROVER_CUSTOM_BITVECTOR_ANALYSIS
67 void pthread_mutex_cleanup(
void *p)
72 "mutex must be destroyed");
77 pthread_mutex_t *mutex,
78 const pthread_mutexattr_t *mutexattr)
82 if(mutexattr!=0) (void)*mutexattr;
84 #ifdef __CPROVER_CUSTOM_BITVECTOR_ANALYSIS
97 #ifndef __CPROVER_PTHREAD_H_INCLUDED
99 #define __CPROVER_PTHREAD_H_INCLUDED
102 #ifndef __CPROVER_mutex_t_defined
103 #define __CPROVER_mutex_t_defined
104 #if defined __CYGWIN__ || defined __MINGW32__ || defined _WIN32
115 #ifdef __CPROVER_CUSTOM_BITVECTOR_ANALYSIS
117 "mutex must be initialized");
120 "mutex must not be destroyed");
124 "attempt to lock non-recurisive locked mutex");
130 "mutex not initialised or destroyed");
138 "WWcumul",
"RRcumul",
"RWcumul",
"WRcumul");
146 #ifndef __CPROVER_PTHREAD_H_INCLUDED
148 #define __CPROVER_PTHREAD_H_INCLUDED
151 #ifndef __CPROVER_mutex_t_defined
152 #define __CPROVER_mutex_t_defined
153 #if defined __CYGWIN__ || defined __MINGW32__ || defined _WIN32
167 #ifdef __CPROVER_CUSTOM_BITVECTOR_ANALYSIS
169 "mutex must be initialized");
172 "mutex not initialised or destroyed");
190 "WWcumul",
"RRcumul",
"RWcumul",
"WRcumul");
197 #ifndef __CPROVER_PTHREAD_H_INCLUDED
199 #define __CPROVER_PTHREAD_H_INCLUDED
202 #ifndef __CPROVER_mutex_t_defined
203 #define __CPROVER_mutex_t_defined
204 #if defined __CYGWIN__ || defined __MINGW32__ || defined _WIN32
216 #ifdef __CPROVER_CUSTOM_BITVECTOR_ANALYSIS
218 "mutex must be initialized");
221 "mutex must be locked");
224 "mutex must not be destroyed");
232 "WWcumul",
"RRcumul",
"RWcumul",
"WRcumul");
235 "must hold lock upon unlock");
245 #ifndef __CPROVER_PTHREAD_H_INCLUDED
247 #define __CPROVER_PTHREAD_H_INCLUDED
250 #ifndef __CPROVER_mutex_t_defined
251 #define __CPROVER_mutex_t_defined
252 #if defined __CYGWIN__ || defined __MINGW32__ || defined _WIN32
264 #ifdef __CPROVER_CUSTOM_BITVECTOR_ANALYSIS
266 "mutex must be initialized");
269 "mutex must not be locked");
272 "mutex must not be destroyed");
279 "lock held upon destroy");
289 #ifndef __CPROVER_PTHREAD_H_INCLUDED
291 #define __CPROVER_PTHREAD_H_INCLUDED
299 __CPROVER_thread_local
const void
301 __CPROVER_thread_local void (
309 if(value_ptr!=0) (void)*(
char*)value_ptr;
317 if(__CPROVER_thread_key_dtors[i] && key)
318 __CPROVER_thread_key_dtors[i](key);
330 #ifndef __CPROVER_PTHREAD_H_INCLUDED
332 #define __CPROVER_PTHREAD_H_INCLUDED
335 #ifndef __CPROVER_ERRNO_H_INCLUDED
337 #define __CPROVER_ERRNO_H_INCLUDED
341 #ifndef LIBRARY_CHECK
350 #ifdef __CPROVER_CUSTOM_BITVECTOR_ANALYSIS
353 "pthread_join must be given valid thread ID");
358 if(value_ptr!=0) (void)**(
char**)value_ptr;
368 #ifndef __CPROVER_PTHREAD_H_INCLUDED
370 #define __CPROVER_PTHREAD_H_INCLUDED
373 #ifndef __CPROVER_ERRNO_H_INCLUDED
375 #define __CPROVER_ERRNO_H_INCLUDED
380 # ifndef LIBRARY_CHECK
385 int _pthread_join(pthread_t thread,
void **value_ptr)
389 #ifdef __CPROVER_CUSTOM_BITVECTOR_ANALYSIS
392 "pthread_join must be given valid thread ID");
397 if(value_ptr!=0) (void)**(
char**)value_ptr;
406 #ifndef __CPROVER_PTHREAD_H_INCLUDED
408 #define __CPROVER_PTHREAD_H_INCLUDED
415 "rwlock held upon destroy");
416 *((
signed char *)lock)=-1;
418 #ifdef __CPROVER_CUSTOM_BITVECTOR_ANALYSIS
427 #ifndef __CPROVER_PTHREAD_H_INCLUDED
429 #define __CPROVER_PTHREAD_H_INCLUDED
432 #ifdef __CPROVER_CUSTOM_BITVECTOR_ANALYSIS
433 void pthread_rwlock_cleanup(
void *p)
437 "rwlock must be destroyed");
442 pthread_rwlock_t *lock,
443 const pthread_rwlockattr_t *attr)
446 (*(
signed char *)lock)=0;
447 if(attr!=0) (void)*attr;
449 #ifdef __CPROVER_CUSTOM_BITVECTOR_ANALYSIS
458 #ifndef __CPROVER_PTHREAD_H_INCLUDED
460 #define __CPROVER_PTHREAD_H_INCLUDED
468 "lock not initialised or destroyed");
470 *((
signed char *)lock)=1;
477 #ifndef __CPROVER_PTHREAD_H_INCLUDED
479 #define __CPROVER_PTHREAD_H_INCLUDED
487 (*(
signed char *)lock)|=1;
494 #ifndef __CPROVER_PTHREAD_H_INCLUDED
496 #define __CPROVER_PTHREAD_H_INCLUDED
504 (*(
signed char *)lock)=2;
511 #ifndef __CPROVER_PTHREAD_H_INCLUDED
513 #define __CPROVER_PTHREAD_H_INCLUDED
520 "must hold lock upon unlock");
522 *((
signed char *)lock)=0;
528 #ifndef __CPROVER_PTHREAD_H_INCLUDED
530 #define __CPROVER_PTHREAD_H_INCLUDED
538 "lock not initialised or destroyed");
540 *((
signed char *)lock)=2;
548 #ifndef LIBRARY_CHECK
554 __CPROVER_thread_local
const void
556 __CPROVER_thread_local void (
562 unsigned long this_thread_id,
566 void (**thread_key_dtors)(
void *),
568 unsigned long next_thread_key,
569 void *(*start_routine)(
void *),
579 __CPROVER_thread_key_dtors[i] = thread_key_dtors[i];
581 #ifdef __CPROVER_CUSTOM_BITVECTOR_ANALYSIS
603 if(__CPROVER_thread_key_dtors[i] && key)
604 __CPROVER_thread_key_dtors[i](key);
612 #ifndef __CPROVER_PTHREAD_H_INCLUDED
613 # include <pthread.h>
614 # define __CPROVER_PTHREAD_H_INCLUDED
617 #ifndef LIBRARY_CHECK
620 __CPROVER_thread_local void (
627 unsigned long this_thread_id,
631 void (**thread_key_dtors)(
void *),
633 unsigned long next_thread_key,
634 void *(*start_routine)(
void *),
639 const pthread_attr_t *attr,
640 void *(*start_routine)(
void *),
644 unsigned long this_thread_id;
650 *thread=(pthread_t)this_thread_id;
652 #ifdef __CPROVER_CUSTOM_BITVECTOR_ANALYSIS
656 if(attr) (void)*attr;
662 void (**thread_key_dtors)(
void *) = __CPROVER_thread_key_dtors;
682 #ifndef __CPROVER_PTHREAD_H_INCLUDED
684 #define __CPROVER_PTHREAD_H_INCLUDED
689 *((
unsigned *)cond)=0;
690 if(attr) (void)*attr;
696 #ifndef __CPROVER_PTHREAD_H_INCLUDED
698 #define __CPROVER_PTHREAD_H_INCLUDED
704 (*((
unsigned *)cond))++;
711 #ifndef __CPROVER_PTHREAD_H_INCLUDED
713 #define __CPROVER_PTHREAD_H_INCLUDED
719 *((
unsigned *)cond)=(unsigned)-1;
726 #ifndef __CPROVER_PTHREAD_H_INCLUDED
728 #define __CPROVER_PTHREAD_H_INCLUDED
736 #ifdef __CPROVER_CUSTOM_BITVECTOR_ANALYSIS
738 "mutex must be initialized");
741 "mutex must be locked");
744 "mutex must not be destroyed");
750 if(*((
unsigned *)cond))
751 (*((
unsigned *)cond))--;
759 #ifndef __CPROVER_PTHREAD_H_INCLUDED
761 #define __CPROVER_PTHREAD_H_INCLUDED
771 (*((
unsigned *)lock))=1;
775 "WWcumul",
"RRcumul",
"RWcumul",
"WRcumul");
782 #ifndef __CPROVER_PTHREAD_H_INCLUDED
784 #define __CPROVER_PTHREAD_H_INCLUDED
795 "WWcumul",
"RRcumul",
"RWcumul",
"WRcumul");
796 *((
unsigned *)lock) = 0;
803 #ifndef __CPROVER_PTHREAD_H_INCLUDED
805 #define __CPROVER_PTHREAD_H_INCLUDED
808 #ifndef __CPROVER_ERRNO_H_INCLUDED
810 #define __CPROVER_ERRNO_H_INCLUDED
820 if(*((
unsigned *)lock))
825 (*((
unsigned *)lock))=1;
830 "WWcumul",
"RRcumul",
"RWcumul",
"WRcumul");
837 #ifndef __CPROVER_PTHREAD_H_INCLUDED
839 #define __CPROVER_PTHREAD_H_INCLUDED
846 #if !defined(__APPLE__) && !defined(__OpenBSD__)
848 pthread_barrier_t *
restrict barrier,
849 const pthread_barrierattr_t *
restrict attr,
857 #ifdef __CPROVER_CUSTOM_BITVECTOR_ANALYSIS
868 #if defined(__OpenBSD__)
870 pthread_barrier_t *
restrict barrier,
871 pthread_barrierattr_t *
restrict attr,
879 #ifdef __CPROVER_CUSTOM_BITVECTOR_ANALYSIS
891 #ifndef __CPROVER_PTHREAD_H_INCLUDED
893 #define __CPROVER_PTHREAD_H_INCLUDED
906 #ifdef __CPROVER_CUSTOM_BITVECTOR_ANALYSIS
908 "pthread barrier must be initialized");
910 "pthread barrier must not be destroyed");
921 #ifndef __CPROVER_PTHREAD_H_INCLUDED
923 #define __CPROVER_PTHREAD_H_INCLUDED
936 #ifdef __CPROVER_CUSTOM_BITVECTOR_ANALYSIS
938 "pthread barrier must be initialized");
940 "pthread barrier must not be destroyed");
950 #ifndef __CPROVER_PTHREAD_H_INCLUDED
952 #define __CPROVER_PTHREAD_H_INCLUDED
955 __CPROVER_thread_local
const void
957 #ifndef LIBRARY_CHECK
959 __CPROVER_thread_local void (
982 #ifndef __CPROVER_PTHREAD_H_INCLUDED
984 #define __CPROVER_PTHREAD_H_INCLUDED
987 __CPROVER_thread_local
const void
999 #ifndef __CPROVER_PTHREAD_H_INCLUDED
1000 #include <pthread.h>
1001 #define __CPROVER_PTHREAD_H_INCLUDED
1004 __CPROVER_thread_local
const void
1015 #ifndef __CPROVER_PTHREAD_H_INCLUDED
1016 #include <pthread.h>
1017 #define __CPROVER_PTHREAD_H_INCLUDED
1020 __CPROVER_thread_local
const void
#define __CPROVER_constant_infinity_uint
mini_bddt restrict(const mini_bddt &u, unsigned var, const bool value)
int __VERIFIER_nondet_int(void)
void pthread_exit(void *value_ptr)
int pthread_rwlock_destroy(pthread_rwlock_t *lock)
int pthread_mutex_lock(pthread_mutex_t *mutex)
int pthread_cond_signal(pthread_cond_t *cond)
int pthread_setspecific(pthread_key_t key, const void *value)
int pthread_rwlock_tryrdlock(pthread_rwlock_t *lock)
int pthread_mutex_trylock(pthread_mutex_t *mutex)
int pthread_rwlock_unlock(pthread_rwlock_t *lock)
void __spawned_thread(unsigned long this_thread_id, unsigned long next_thread_key, void *(*start_routine)(void *), void *arg)
__CPROVER_thread_local unsigned long __CPROVER_next_thread_key
int pthread_rwlock_wrlock(pthread_rwlock_t *lock)
void * pthread_getspecific(pthread_key_t key)
__CPROVER_thread_local unsigned long __CPROVER_thread_id
int pthread_spin_unlock(pthread_spinlock_t *lock)
int pthread_mutex_destroy(pthread_mutex_t *mutex)
int pthread_rwlock_rdlock(pthread_rwlock_t *lock)
int pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *mutexattr)
signed char __CPROVER_mutex_t
int pthread_spin_lock(pthread_spinlock_t *lock)
int pthread_rwlock_init(pthread_rwlock_t *lock, const pthread_rwlockattr_t *attr)
unsigned long __CPROVER_next_thread_id
int pthread_barrier_init(pthread_barrier_t *restrict barrier, const pthread_barrierattr_t *restrict attr, unsigned count)
int pthread_mutexattr_settype(pthread_mutexattr_t *attr, int type)
int pthread_barrier_wait(pthread_barrier_t *barrier)
int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex)
int pthread_mutex_unlock(pthread_mutex_t *mutex)
int pthread_cancel(pthread_t thread)
int pthread_join(pthread_t thread, void **value_ptr)
int pthread_spin_trylock(pthread_spinlock_t *lock)
int pthread_cond_init(pthread_cond_t *cond, const pthread_condattr_t *attr)
__CPROVER_bool __CPROVER_threads_exited[__CPROVER_constant_infinity_uint]
int pthread_create(pthread_t *thread, const pthread_attr_t *attr, void *(*start_routine)(void *), void *arg)
int pthread_barrier_destroy(pthread_barrier_t *barrier)
int pthread_key_delete(pthread_key_t key)
__CPROVER_thread_local const void * __CPROVER_thread_keys[__CPROVER_constant_infinity_uint]
int pthread_key_create(pthread_key_t *key, void(*destructor)(void *))
int pthread_rwlock_trywrlock(pthread_rwlock_t *lock)
int pthread_cond_broadcast(pthread_cond_t *cond)