Skip to content
Snippets Groups Projects
Commit c0f39bb5 authored by Kaspar Schleiser's avatar Kaspar Schleiser
Browse files

sys: posix: pthread: fix mutex usage

parent 350c341c
No related branches found
No related tags found
No related merge requests found
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include <time.h> #include <time.h>
#include "mutex.h" #include "mutex.h"
#include "priority_queue.h"
#if defined(CPU_CC430) || defined(CPU_MSP430FXYZ) #if defined(CPU_CC430) || defined(CPU_MSP430FXYZ)
# include "msp430_types.h" # include "msp430_types.h"
...@@ -120,7 +121,7 @@ int pthread_cond_destroy(struct pthread_cond_t *cond); ...@@ -120,7 +121,7 @@ int pthread_cond_destroy(struct pthread_cond_t *cond);
* @param[in, out] mutex pre-allocated mutex variable structure. * @param[in, out] mutex pre-allocated mutex variable structure.
* @return returns 0 on success, an errorcode otherwise. * @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 * @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); ...@@ -129,7 +130,7 @@ int pthread_cond_wait(struct pthread_cond_t *cond, struct mutex_t *mutex);
* @param[in] abstime pre-allocated timeout. * @param[in] abstime pre-allocated timeout.
* @return returns 0 on success, an errorcode otherwise. * @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 * @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 { ...@@ -71,7 +71,7 @@ typedef struct pthread_thread {
} pthread_thread_t; } pthread_thread_t;
static pthread_thread_t *volatile pthread_sched_threads[MAXTHREADS]; 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; static volatile kernel_pid_t pthread_reaper_pid = KERNEL_PID_UNDEF;
......
...@@ -92,7 +92,7 @@ int pthread_cond_destroy(struct pthread_cond_t *cond) ...@@ -92,7 +92,7 @@ int pthread_cond_destroy(struct pthread_cond_t *cond)
return 0; 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; priority_queue_node_t n;
n.priority = sched_active_thread->priority; n.priority = sched_active_thread->priority;
...@@ -118,7 +118,7 @@ int pthread_cond_wait(struct pthread_cond_t *cond, struct mutex_t *mutex) ...@@ -118,7 +118,7 @@ int pthread_cond_wait(struct pthread_cond_t *cond, struct mutex_t *mutex)
return 0; 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; timex_t now, then, reltime;
......
...@@ -36,7 +36,7 @@ struct __pthread_tls_key { ...@@ -36,7 +36,7 @@ struct __pthread_tls_key {
/** /**
* @brief Used while manipulating the TLS of a pthread. * @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. * @brief Find a thread-specific datum.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment