Skip to content
Browse files

Added const modifiers.

  • Loading branch information...
1 parent 655f163 commit 575ada1c237d96890b61d8f9635e51b26cb4dda6 Brian Ford committed Jan 17, 2011
Showing with 38 additions and 38 deletions.
  1. +20 −20 include/pthread.h
  2. +1 −1 src/barrier.c
  3. +3 −3 src/cond.c
  4. +6 −6 src/mutex.c
  5. +2 −2 src/rwlock.c
  6. +6 −6 src/thread.c
View
40 include/pthread.h
@@ -255,7 +255,7 @@ int sched_setscheduler(pid_t pid, int pol);
int pthread_attr_setschedparam(pthread_attr_t *attr, const struct sched_param *param);
int pthread_attr_getschedparam(const pthread_attr_t *attr, struct sched_param *param);
int pthread_getschedparam(pthread_t thread, int *pol, struct sched_param *param);
-int pthread_setschedparam(pthread_t thread, int pol, const struct sched_param *param);
+int pthread_setschedparam(pthread_t thread, int pol, const struct sched_param *param);
/* synchronization objects */
typedef void *pthread_spinlock_t;
@@ -301,41 +301,41 @@ void _pthread_invoke_cancel(void);
void pthread_testcancel(void);
int pthread_cancel(pthread_t t);
int pthread_kill(pthread_t t, int sig);
-unsigned _pthread_get_state(pthread_attr_t *attr, unsigned flag);
+unsigned _pthread_get_state(const pthread_attr_t *attr, unsigned flag);
int _pthread_set_state(pthread_attr_t *attr, unsigned flag, unsigned val);
int pthread_setcancelstate(int state, int *oldstate);
int pthread_setcanceltype(int type, int *oldtype);
int pthread_create_wrapper(void *args);
-int pthread_create(pthread_t *th, pthread_attr_t *attr, void *(* func)(void *), void *arg);
+int pthread_create(pthread_t *th, const pthread_attr_t *attr, void *(* func)(void *), void *arg);
int pthread_join(pthread_t t, void **res);
int pthread_detach(pthread_t t);
-int pthread_rwlock_init (pthread_rwlock_t *rwlock_, const pthread_rwlockattr_t *attr);
+int pthread_rwlock_init(pthread_rwlock_t *rwlock_, const pthread_rwlockattr_t *attr);
int pthread_rwlock_wrlock(pthread_rwlock_t *l);
-int pthread_rwlock_timedwrlock(pthread_rwlock_t *rwlock, struct timespec *ts);
+int pthread_rwlock_timedwrlock(pthread_rwlock_t *rwlock, const struct timespec *ts);
int pthread_rwlock_rdlock(pthread_rwlock_t *l);
-int pthread_rwlock_timedrdlock(pthread_rwlock_t *l, struct timespec *ts);
+int pthread_rwlock_timedrdlock(pthread_rwlock_t *l, const struct timespec *ts);
int pthread_rwlock_unlock(pthread_rwlock_t *l);
int pthread_rwlock_tryrdlock(pthread_rwlock_t *l);
int pthread_rwlock_trywrlock(pthread_rwlock_t *l);
int pthread_rwlock_destroy (pthread_rwlock_t *l);
-int pthread_cond_init(pthread_cond_t *cv, pthread_condattr_t *a);
+int pthread_cond_init(pthread_cond_t *cv, const pthread_condattr_t *a);
int pthread_cond_destroy(pthread_cond_t *cv);
int pthread_cond_signal (pthread_cond_t *cv);
int pthread_cond_broadcast (pthread_cond_t *cv);
int pthread_cond_wait (pthread_cond_t *cv, pthread_mutex_t *external_mutex);
-int pthread_cond_timedwait(pthread_cond_t *cv, pthread_mutex_t *external_mutex, struct timespec *t);
+int pthread_cond_timedwait(pthread_cond_t *cv, pthread_mutex_t *external_mutex, const struct timespec *t);
int pthread_mutex_lock(pthread_mutex_t *m);
-int pthread_mutex_timedlock(pthread_mutex_t *m, struct timespec *ts);
+int pthread_mutex_timedlock(pthread_mutex_t *m, const struct timespec *ts);
int pthread_mutex_unlock(pthread_mutex_t *m);
int pthread_mutex_trylock(pthread_mutex_t *m);
-int pthread_mutex_init(pthread_mutex_t *m, pthread_mutexattr_t *a);
+int pthread_mutex_init(pthread_mutex_t *m, const pthread_mutexattr_t *a);
int pthread_mutex_destroy(pthread_mutex_t *m);
int pthread_barrier_destroy(pthread_barrier_t *b);
-int pthread_barrier_init(pthread_barrier_t *b, void *attr, unsigned int count);
+int pthread_barrier_init(pthread_barrier_t *b, const void *attr, unsigned int count);
int pthread_barrier_wait(pthread_barrier_t *b);
int pthread_spin_init(pthread_spinlock_t *l, int pshared);
@@ -348,30 +348,30 @@ int pthread_spin_unlock(pthread_spinlock_t *l);
int pthread_attr_init(pthread_attr_t *attr);
int pthread_attr_destroy(pthread_attr_t *attr);
int pthread_attr_setdetachstate(pthread_attr_t *a, int flag);
-int pthread_attr_getdetachstate(pthread_attr_t *a, int *flag);
+int pthread_attr_getdetachstate(const pthread_attr_t *a, int *flag);
int pthread_attr_setinheritsched(pthread_attr_t *a, int flag);
-int pthread_attr_getinheritsched(pthread_attr_t *a, int *flag);
+int pthread_attr_getinheritsched(const pthread_attr_t *a, int *flag);
int pthread_attr_setscope(pthread_attr_t *a, int flag);
-int pthread_attr_getscope(pthread_attr_t *a, int *flag);
+int pthread_attr_getscope(const pthread_attr_t *a, int *flag);
int pthread_attr_getstackaddr(pthread_attr_t *attr, void **stack);
int pthread_attr_setstackaddr(pthread_attr_t *attr, void *stack);
-int pthread_attr_getstacksize(pthread_attr_t *attr, size_t *size);
+int pthread_attr_getstacksize(const pthread_attr_t *attr, size_t *size);
int pthread_attr_setstacksize(pthread_attr_t *attr, size_t size);
int pthread_mutexattr_init(pthread_mutexattr_t *a);
int pthread_mutexattr_destroy(pthread_mutexattr_t *a);
-int pthread_mutexattr_gettype(pthread_mutexattr_t *a, int *type);
+int pthread_mutexattr_gettype(const pthread_mutexattr_t *a, int *type);
int pthread_mutexattr_settype(pthread_mutexattr_t *a, int type);
-int pthread_mutexattr_getpshared(pthread_mutexattr_t *a, int *type);
+int pthread_mutexattr_getpshared(const pthread_mutexattr_t *a, int *type);
int pthread_mutexattr_setpshared(pthread_mutexattr_t * a, int type);
-int pthread_mutexattr_getprotocol(pthread_mutexattr_t *a, int *type);
+int pthread_mutexattr_getprotocol(const pthread_mutexattr_t *a, int *type);
int pthread_mutexattr_setprotocol(pthread_mutexattr_t *a, int type);
-int pthread_mutexattr_getprioceiling(pthread_mutexattr_t *a, int * prio);
+int pthread_mutexattr_getprioceiling(const pthread_mutexattr_t *a, int * prio);
int pthread_mutexattr_setprioceiling(pthread_mutexattr_t *a, int prio);
int pthread_condattr_destroy(pthread_condattr_t *a);
int pthread_condattr_init(pthread_condattr_t *a);
-int pthread_condattr_getpshared(pthread_condattr_t *a, int *s);
+int pthread_condattr_getpshared(const pthread_condattr_t *a, int *s);
int pthread_condattr_setpshared(pthread_condattr_t *a, int s);
int pthread_barrierattr_init(void **attr);
View
2 src/barrier.c
@@ -105,7 +105,7 @@ int pthread_barrier_destroy(pthread_barrier_t *b_)
}
int
-pthread_barrier_init (pthread_barrier_t *b_, void *attr, unsigned int count)
+pthread_barrier_init (pthread_barrier_t *b_, const void *attr, unsigned int count)
{
barrier_t *b;
View
6 src/cond.c
@@ -90,7 +90,7 @@ int pthread_condattr_init(pthread_condattr_t *a)
return 0;
}
-int pthread_condattr_getpshared(pthread_condattr_t *a, int *s)
+int pthread_condattr_getpshared(const pthread_condattr_t *a, int *s)
{
if (!a || !s)
return EINVAL;
@@ -111,7 +111,7 @@ int pthread_condattr_setpshared(pthread_condattr_t *a, int s)
return 0;
}
-int pthread_cond_init(pthread_cond_t *c, pthread_condattr_t *a)
+int pthread_cond_init(pthread_cond_t *c, const pthread_condattr_t *a)
{
cond_t *_c;
int r = 0;
@@ -372,7 +372,7 @@ int pthread_cond_wait (pthread_cond_t *c, pthread_mutex_t *external_mutex)
return r;
}
-int pthread_cond_timedwait(pthread_cond_t *c, pthread_mutex_t *external_mutex, struct timespec *t)
+int pthread_cond_timedwait(pthread_cond_t *c, pthread_mutex_t *external_mutex, const struct timespec *t)
{
sCondWaitHelper ch;
DWORD dwr;
View
12 src/mutex.c
@@ -306,7 +306,7 @@ static inline void _UndoWaitCriticalSection(RTL_CRITICAL_SECTION *prc)
InterlockedExchangeAdd(&prc->LockCount, -LockDelta);
}
-int pthread_mutex_timedlock(pthread_mutex_t *m, struct timespec *ts)
+int pthread_mutex_timedlock(pthread_mutex_t *m, const struct timespec *ts)
{
unsigned long long t, ct;
#ifndef USE_MUTEX_Mutex
@@ -446,7 +446,7 @@ static void _mutex_init_once(mutex_t *m)
#endif
}
-int pthread_mutex_init(pthread_mutex_t *m, pthread_mutexattr_t *a)
+int pthread_mutex_init(pthread_mutex_t *m, const pthread_mutexattr_t *a)
{
mutex_t *_m;
@@ -536,7 +536,7 @@ int pthread_mutexattr_destroy(pthread_mutexattr_t *a)
return 0;
}
-int pthread_mutexattr_gettype(pthread_mutexattr_t *a, int *type)
+int pthread_mutexattr_gettype(const pthread_mutexattr_t *a, int *type)
{
if (!a || !type)
return EINVAL;
@@ -555,7 +555,7 @@ int pthread_mutexattr_settype(pthread_mutexattr_t *a, int type)
return 0;
}
-int pthread_mutexattr_getpshared(pthread_mutexattr_t *a, int *type)
+int pthread_mutexattr_getpshared(const pthread_mutexattr_t *a, int *type)
{
if (!a || !type)
return EINVAL;
@@ -582,7 +582,7 @@ int pthread_mutexattr_setpshared(pthread_mutexattr_t * a, int type)
return r;
}
-int pthread_mutexattr_getprotocol(pthread_mutexattr_t *a, int *type)
+int pthread_mutexattr_getprotocol(const pthread_mutexattr_t *a, int *type)
{
*type = *a & (8 + 16);
@@ -599,7 +599,7 @@ int pthread_mutexattr_setprotocol(pthread_mutexattr_t *a, int type)
return 0;
}
-int pthread_mutexattr_getprioceiling(pthread_mutexattr_t *a, int * prio)
+int pthread_mutexattr_getprioceiling(const pthread_mutexattr_t *a, int * prio)
{
*prio = *a / PTHREAD_PRIO_MULT;
return 0;
View
4 src/rwlock.c
@@ -253,7 +253,7 @@ int pthread_rwlock_rdlock (pthread_rwlock_t *rwlock_)
return rwl_unref(rwlock_, ret);
}
-int pthread_rwlock_timedrdlock (pthread_rwlock_t *rwlock_, struct timespec *ts)
+int pthread_rwlock_timedrdlock (pthread_rwlock_t *rwlock_, const struct timespec *ts)
{
rwlock_t *rwlock;
int ret;
@@ -433,7 +433,7 @@ int pthread_rwlock_wrlock (pthread_rwlock_t *rwlock_)
return rwl_unref(rwlock_,ret);
}
-int pthread_rwlock_timedwrlock (pthread_rwlock_t *rwlock_, struct timespec *ts)
+int pthread_rwlock_timedwrlock (pthread_rwlock_t *rwlock_, const struct timespec *ts)
{
int ret;
rwlock_t *rwlock;
View
12 src/thread.c
@@ -784,7 +784,7 @@ int pthread_kill(pthread_t t, int sig)
return pthread_cancel(t);
}
-unsigned _pthread_get_state(pthread_attr_t *attr, unsigned flag)
+unsigned _pthread_get_state(const pthread_attr_t *attr, unsigned flag)
{
return (attr->p_state & flag);
}
@@ -819,7 +819,7 @@ int pthread_attr_setdetachstate(pthread_attr_t *a, int flag)
return _pthread_set_state(a, PTHREAD_CREATE_DETACHED, flag);
}
-int pthread_attr_getdetachstate(pthread_attr_t *a, int *flag)
+int pthread_attr_getdetachstate(const pthread_attr_t *a, int *flag)
{
*flag = _pthread_get_state(a, PTHREAD_CREATE_DETACHED);
return 0;
@@ -832,7 +832,7 @@ int pthread_attr_setinheritsched(pthread_attr_t *a, int flag)
return _pthread_set_state(a, PTHREAD_INHERIT_SCHED, flag);
}
-int pthread_attr_getinheritsched(pthread_attr_t *a, int *flag)
+int pthread_attr_getinheritsched(const pthread_attr_t *a, int *flag)
{
*flag = _pthread_get_state(a, PTHREAD_INHERIT_SCHED);
return 0;
@@ -843,7 +843,7 @@ int pthread_attr_setscope(pthread_attr_t *a, int flag)
return _pthread_set_state(a, PTHREAD_SCOPE_SYSTEM, flag);
}
-int pthread_attr_getscope(pthread_attr_t *a, int *flag)
+int pthread_attr_getscope(const pthread_attr_t *a, int *flag)
{
*flag = _pthread_get_state(a, PTHREAD_SCOPE_SYSTEM);
return 0;
@@ -861,7 +861,7 @@ int pthread_attr_setstackaddr(pthread_attr_t *attr, void *stack)
return 0;
}
-int pthread_attr_getstacksize(pthread_attr_t *attr, size_t *size)
+int pthread_attr_getstacksize(const pthread_attr_t *attr, size_t *size)
{
*size = attr->s_size;
return 0;
@@ -976,7 +976,7 @@ int pthread_create_wrapper(void *args)
return rslt;
}
-int pthread_create(pthread_t *th, pthread_attr_t *attr, void *(* func)(void *), void *arg)
+int pthread_create(pthread_t *th, const pthread_attr_t *attr, void *(* func)(void *), void *arg)
{
HANDLE thrd = NULL;
struct _pthread_v *tv;

0 comments on commit 575ada1

Please sign in to comment.
Something went wrong with that request. Please try again.