source: CIVL/include/headers/pthread.h@ 1aaefd4

main test-branch
Last change on this file since 1aaefd4 was ea777aa, checked in by Alex Wilton <awilton@…>, 3 years ago

Moved examples, include, build_default.properties, common.xml, and README out from dev.civl.com into the root of the repo.

git-svn-id: svn://vsl.cis.udel.edu/civl/trunk@5704 fb995dde-84ed-4084-dfe6-e5aef3e2452c

  • Property mode set to 100644
File size: 5.0 KB
Line 
1/*
2 All specification references correspond to pages in the Standard for Information Technology
3Portable Operating System Interface (POSIX)IEEE Computer Society Base Specifications, Issue 7.
4
5Standard modifications to each translation:
6header files are altered
7errors are changed to assertion violations with appropriate messages
8appropriate definitions are changed to input variables
9*/
10
11#ifndef _PTHREAD_
12#define _PTHREAD_
13#ifdef NULL
14#else
15#define NULL ((void*)0)
16#endif
17/*#ifdef __SVCOMP__
18#else
19#include <svcomp.h>
20#endif*/
21
22// don't think this should be here, but this is using CIVL's $proc
23// need to talk about it...
24#include <civlc.cvh>
25#include<civl-pthread.cvh>
26
27//Mutex types
28enum{
29 PTHREAD_MUTEX_NORMAL,
30 PTHREAD_MUTEX_RECURSIVE,
31 PTHREAD_MUTEX_ERRORCHECK
32};
33
34enum{
35 PTHREAD_MUTEX_STALLED,
36 PTHREAD_MUTEX_ROBUST
37};
38
39enum{
40 PTHREAD_CREATE_JOINABLE,
41 PTHREAD_CREATE_DETACHED
42};
43
44enum{
45 PTHREAD_SCOPE_SYSTEM,
46 PTHREAD_SCOPE_PROCESS
47};
48
49enum{
50 PTHREAD_INHERIT_SCHED,
51 PTHREAD_EXPLICIT_SCHED
52};
53
54enum{
55 PTHREAD_PROCESS_SHARED,
56 PTHREAD_PROCESS_PRIVATE,
57};
58
59enum{
60 PTHREAD_BARRIER_SERIAL_THREAD
61};
62
63//Error definitions
64enum{
65 EINVAL, //Designates an invalid value
66 ENOTSUP,
67 EOWNERDEAD, //Designates the termination of the owning thread
68 EBUSY, //Mutex is already locked
69 EDEADLK, //If mutex type is errorcheck and already owns the mutex
70 EPERM, //If mutex is robust or errorcheck and does not own the mutex
71 ERSCH
72};
73
74typedef struct pthread_mutexattr_t pthread_mutexattr_t;
75typedef struct pthread_mutex_t pthread_mutex_t;
76typedef struct pthread_barrierattr_t pthread_barrierattr_t;
77typedef struct pthread_barrier_t pthread_barrier_t;
78typedef struct pthread_spinlock_t pthread_spinlock_t;
79//typedef struct pthread_attr_t pthread_attr_t;
80typedef struct pthread_rwlockattr_t pthread_rwlockattr_t;
81typedef struct pthread_rwlock_t pthread_rwlock_t;
82typedef struct pthread_cond_t pthread_cond_t;
83typedef int pthread_condattr_t;
84//typedef struct pthread_t pthread_t;
85
86extern pthread_mutex_t PTHREAD_MUTEX_INITIALIZER;// {0,$proc_null,0,0,{0,0,0,PTHREAD_MUTEX_NORMAL,0}}
87
88// Function Prototypes
89int pthread_attr_destroy(pthread_attr_t *);
90int pthread_attr_setdetachstate(pthread_attr_t *, int);
91int pthread_attr_getdetachstate(const pthread_attr_t *, int *);
92int pthread_attr_init(pthread_attr_t *);
93int pthread_spin_init(pthread_spinlock_t *, int);
94int pthread_spin_destroy(pthread_spinlock_t *);
95int pthread_spin_lock(pthread_spinlock_t *);
96int pthread_spin_unlock(pthread_spinlock_t *);
97int pthread_rwlock_init(pthread_rwlock_t *, const pthread_rwlockattr_t *);
98int pthread_rwlock_destroy(pthread_rwlock_t *);
99int pthread_rwlock_rdlock(pthread_rwlock_t *);
100int pthread_rwlock_wrlock(pthread_rwlock_t *);
101int pthread_rwlock_unlock(pthread_rwlock_t *);
102int pthread_barrierattr_init(pthread_barrierattr_t *);
103int pthread_barrierattr_destroy(pthread_barrierattr_t *);
104int pthread_barrier_init(pthread_barrier_t *, const pthread_barrierattr_t *, int);
105int pthread_barrier_destroy(pthread_barrier_t *);
106int pthread_barrier_wait(pthread_barrier_t *);
107int pthread_mutexattr_init(pthread_mutexattr_t *);
108int pthread_mutexattr_destroy(pthread_mutexattr_t *);
109int pthread_mutexattr_getrobust(const pthread_mutexattr_t *, int *);
110int pthread_mutexattr_setrobust(pthread_mutexattr_t *, int);
111int pthread_mutexattr_getpshared(const pthread_mutexattr_t *, int *);
112int pthread_mutexattr_setpshared(pthread_mutexattr_t *, int);
113int pthread_mutexattr_getprotocol(const pthread_mutexattr_t *, int *);
114int pthread_mutexattr_setprotocol(pthread_mutexattr_t *, int);
115int pthread_mutexattr_gettype(const pthread_mutexattr_t *, int *);
116int pthread_mutexattr_settype(pthread_mutexattr_t *, int);
117int pthread_mutexattr_getprioceiling(const pthread_mutexattr_t *, int *);
118int pthread_mutexattr_setprioceiling(pthread_mutexattr_t *, int);
119int pthread_mutex_init(pthread_mutex_t *, const pthread_mutexattr_t *);
120int pthread_mutex_destroy(pthread_mutex_t *);
121int pthread_cond_init(pthread_cond_t * restrict, const pthread_condattr_t * restrict);
122int pthread_cond_destroy(pthread_cond_t *);
123int pthread_equal(pthread_t, pthread_t);
124int pthread_create(pthread_t *, const pthread_attr_t *, void *(*)(void*), void *);
125int pthread_join(pthread_t, void **);
126void pthread_exit(void *);
127int pthread_mutex_lock(pthread_mutex_t *);
128int pthread_mutex_trylock(pthread_mutex_t *);
129int pthread_mutex_unlock(pthread_mutex_t *);
130int pthread_mutex_consistent(pthread_mutex_t *);
131int pthread_cond_wait(pthread_cond_t *, pthread_mutex_t *);
132int pthread_cond_signal(pthread_cond_t *);
133int pthread_cond_broadcast(pthread_cond_t *);
134pthread_t pthread_self(void);
135
136
137// function declarations needed for transformer:
138void $pthread_exit_main(void *value_ptr, $pthread_pool_t $pthread_pool);
139
140pthread_t $pthread_self($pthread_pool_t pool);
141
142int $pthread_mutex_lock(pthread_mutex_t *mutex, $pthread_pool_t $pthread_pool);
143
144int $pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex, $pthread_pool_t $pthread_pool);
145
146#endif
Note: See TracBrowser for help on using the repository browser.