sys: posix: pthread: fix mutex usage
This commit is contained in:
parent
350c341ce1
commit
c0f39bb55f
@ -19,6 +19,7 @@
|
||||
|
||||
#include <time.h>
|
||||
#include "mutex.h"
|
||||
#include "priority_queue.h"
|
||||
|
||||
#if defined(CPU_CC430) || defined(CPU_MSP430FXYZ)
|
||||
# include "msp430_types.h"
|
||||
@ -120,7 +121,7 @@ int pthread_cond_destroy(struct pthread_cond_t *cond);
|
||||
* @param[in, out] mutex pre-allocated mutex variable structure.
|
||||
* @return returns 0 on success, an errorcode otherwise.
|
||||
*/
|
||||
int pthread_cond_wait(struct pthread_cond_t *cond, struct mutex_t *mutex);
|
||||
int pthread_cond_wait(struct pthread_cond_t *cond, mutex_t *mutex);
|
||||
|
||||
/**
|
||||
* @brief blocks the calling thread until the specified condition cond is signalled
|
||||
@ -129,7 +130,7 @@ int pthread_cond_wait(struct pthread_cond_t *cond, struct mutex_t *mutex);
|
||||
* @param[in] abstime pre-allocated timeout.
|
||||
* @return returns 0 on success, an errorcode otherwise.
|
||||
*/
|
||||
int pthread_cond_timedwait(struct pthread_cond_t *cond, struct mutex_t *mutex, const struct timespec *abstime);
|
||||
int pthread_cond_timedwait(struct pthread_cond_t *cond, mutex_t *mutex, const struct timespec *abstime);
|
||||
|
||||
/**
|
||||
* @brief unblock at least one of the threads that are blocked on the specified condition variable cond
|
||||
|
||||
@ -71,7 +71,7 @@ typedef struct pthread_thread {
|
||||
} pthread_thread_t;
|
||||
|
||||
static pthread_thread_t *volatile pthread_sched_threads[MAXTHREADS];
|
||||
static struct mutex_t pthread_mutex;
|
||||
static mutex_t pthread_mutex;
|
||||
|
||||
static volatile kernel_pid_t pthread_reaper_pid = KERNEL_PID_UNDEF;
|
||||
|
||||
|
||||
@ -92,7 +92,7 @@ int pthread_cond_destroy(struct pthread_cond_t *cond)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int pthread_cond_wait(struct pthread_cond_t *cond, struct mutex_t *mutex)
|
||||
int pthread_cond_wait(struct pthread_cond_t *cond, mutex_t *mutex)
|
||||
{
|
||||
priority_queue_node_t n;
|
||||
n.priority = sched_active_thread->priority;
|
||||
@ -118,7 +118,7 @@ int pthread_cond_wait(struct pthread_cond_t *cond, struct mutex_t *mutex)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int pthread_cond_timedwait(struct pthread_cond_t *cond, struct mutex_t *mutex, const struct timespec *abstime)
|
||||
int pthread_cond_timedwait(struct pthread_cond_t *cond, mutex_t *mutex, const struct timespec *abstime)
|
||||
{
|
||||
timex_t now, then, reltime;
|
||||
|
||||
|
||||
@ -36,7 +36,7 @@ struct __pthread_tls_key {
|
||||
/**
|
||||
* @brief Used while manipulating the TLS of a pthread.
|
||||
*/
|
||||
static struct mutex_t tls_mutex;
|
||||
static mutex_t tls_mutex;
|
||||
|
||||
/**
|
||||
* @brief Find a thread-specific datum.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user