Changes as suggested by Tim
This commit was SVN r2233.
Этот коммит содержится в:
родитель
6ca365c080
Коммит
cbd3442979
@ -7,7 +7,6 @@
|
||||
#include <pthread.h>
|
||||
#include "threads/mutex.h"
|
||||
|
||||
|
||||
struct ompi_condition_t {
|
||||
ompi_object_t super;
|
||||
pthread_cond_t c_cond;
|
||||
@ -19,12 +18,14 @@ OBJ_CLASS_DECLARATION(ompi_condition_t);
|
||||
|
||||
static inline int ompi_condition_wait(ompi_condition_t *c, ompi_mutex_t *m)
|
||||
{
|
||||
return pthread_cond_wait(&c->c_cond, &m->m_lock.thread);
|
||||
return pthread_cond_wait(&c->c_cond, &m->m_lock_pthread);
|
||||
}
|
||||
|
||||
static inline int ompi_condition_timedwait(ompi_condition_t* c, ompi_mutex_t* m, const struct timespec *abstime)
|
||||
static inline int ompi_condition_timedwait(ompi_condition_t *c,
|
||||
ompi_mutex_t *m,
|
||||
const struct timespec *abstime)
|
||||
{
|
||||
return pthread_cond_timedwait(&c->c_cond, &m->m_lock.thread, abstime);
|
||||
return pthread_cond_timedwait(&c->c_cond, &m->m_lock_pthread, abstime);
|
||||
}
|
||||
|
||||
static inline int ompi_condition_signal(ompi_condition_t *c)
|
||||
|
@ -11,7 +11,6 @@
|
||||
|
||||
#if (OMPI_HAVE_THREADS == 0)
|
||||
|
||||
|
||||
static void ompi_condition_construct(ompi_condition_t *c)
|
||||
{
|
||||
c->c_waiting = 0;
|
||||
|
@ -6,10 +6,8 @@
|
||||
|
||||
#include "threads/condition.h"
|
||||
#include "threads/mutex.h"
|
||||
#include "threads/mutex_spinlock.h"
|
||||
#include "runtime/ompi_progress.h"
|
||||
|
||||
|
||||
struct ompi_condition_t {
|
||||
volatile int c_waiting;
|
||||
volatile int c_signaled;
|
||||
@ -40,7 +38,9 @@ static inline int ompi_condition_wait(ompi_condition_t* c, ompi_mutex_t* m)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int ompi_condition_timedwait(ompi_condition_t* c, ompi_mutex_t* m, const struct timespec *abstime)
|
||||
static inline int ompi_condition_timedwait(ompi_condition_t *c,
|
||||
ompi_mutex_t *m,
|
||||
const struct timespec *abstime)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
@ -32,17 +32,17 @@ static void ompi_mutex_destruct(ompi_mutex_t *m)
|
||||
static void ompi_mutex_construct(ompi_mutex_t *m)
|
||||
{
|
||||
#if OMPI_HAVE_POSIX_THREADS
|
||||
pthread_mutex_init(&m->m_lock.thread, 0);
|
||||
pthread_mutex_init(&m->m_lock_pthread, 0);
|
||||
#endif
|
||||
#if OMPI_SYS_ARCH_ATOMIC_H
|
||||
ompi_atomic_unlock(&m->m_lock.atomic);
|
||||
ompi_atomic_unlock(&m->m_lock_atomic);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void ompi_mutex_destruct(ompi_mutex_t *m)
|
||||
{
|
||||
#if OMPI_HAVE_POSIX_THREADS
|
||||
pthread_mutex_destroy(&m->m_lock);
|
||||
pthread_mutex_destroy(&m->m_lock_pthread);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -26,14 +26,8 @@
|
||||
|
||||
struct ompi_mutex_t {
|
||||
ompi_object_t super;
|
||||
union {
|
||||
#if OMPI_HAVE_POSIX_THREADS
|
||||
pthread_mutex_t thread;
|
||||
#endif
|
||||
#if OMPI_SYS_ARCH_ATOMIC_H
|
||||
ompi_lock_t atomic;
|
||||
#endif
|
||||
} m_lock;
|
||||
pthread_mutex_t m_lock_pthread;
|
||||
ompi_lock_t m_lock_atomic;
|
||||
};
|
||||
|
||||
OBJ_CLASS_DECLARATION(ompi_mutex_t);
|
||||
@ -48,33 +42,33 @@ OBJ_CLASS_DECLARATION(ompi_mutex_t);
|
||||
|
||||
static inline int ompi_mutex_trylock(ompi_mutex_t *m)
|
||||
{
|
||||
return pthread_mutex_trylock(&m->m_lock.thread);
|
||||
return pthread_mutex_trylock(&m->m_lock_pthread);
|
||||
}
|
||||
|
||||
static inline void ompi_mutex_lock(ompi_mutex_t *m)
|
||||
{
|
||||
pthread_mutex_lock(&m->m_lock.thread);
|
||||
pthread_mutex_lock(&m->m_lock_pthread);
|
||||
}
|
||||
|
||||
static inline void ompi_mutex_unlock(ompi_mutex_t *m)
|
||||
{
|
||||
pthread_mutex_unlock(&m->m_lock.thread);
|
||||
pthread_mutex_unlock(&m->m_lock_pthread);
|
||||
}
|
||||
|
||||
|
||||
static inline void ompi_mutex_atomic_lock(ompi_mutex_t *m)
|
||||
{
|
||||
ompi_atomic_lock(&m->m_lock.atomic);
|
||||
ompi_atomic_lock(&m->m_lock_atomic);
|
||||
}
|
||||
|
||||
static inline int ompi_mutex_atomic_trylock(ompi_mutex_t *m)
|
||||
{
|
||||
return ompi_atomic_trylock(&m->m_lock.atomic);
|
||||
return ompi_atomic_trylock(&m->m_lock_atomic);
|
||||
}
|
||||
|
||||
static inline void ompi_mutex_atomic_unlock(ompi_mutex_t *m)
|
||||
{
|
||||
ompi_atomic_unlock(&m->m_lock.atomic);
|
||||
ompi_atomic_unlock(&m->m_lock_atomic);
|
||||
}
|
||||
|
||||
|
||||
@ -86,17 +80,17 @@ static inline void ompi_mutex_atomic_unlock(ompi_mutex_t * m)
|
||||
|
||||
static inline int ompi_mutex_trylock(ompi_mutex_t *m)
|
||||
{
|
||||
return pthread_mutex_trylock(&m->m_lock.thread);
|
||||
return pthread_mutex_trylock(&m->m_lock_pthread);
|
||||
}
|
||||
|
||||
static inline void ompi_mutex_lock(ompi_mutex_t *m)
|
||||
{
|
||||
pthread_mutex_lock(&m->m_lock.thread);
|
||||
pthread_mutex_lock(&m->m_lock_pthread);
|
||||
}
|
||||
|
||||
static inline void ompi_mutex_unlock(ompi_mutex_t *m)
|
||||
{
|
||||
pthread_mutex_unlock(&m->m_lock.thread);
|
||||
pthread_mutex_unlock(&m->m_lock_pthread);
|
||||
}
|
||||
|
||||
|
||||
@ -125,17 +119,17 @@ static inline void ompi_mutex_atomic_unlock(ompi_mutex_t * m)
|
||||
|
||||
static inline int ompi_mutex_trylock(ompi_mutex_t *m)
|
||||
{
|
||||
return ompi_atomic_trylock(&m->m_lock.atomic);
|
||||
return ompi_atomic_trylock(&m->m_lock_atomic);
|
||||
}
|
||||
|
||||
static inline void ompi_mutex_lock(ompi_mutex_t *m)
|
||||
{
|
||||
ompi_atomic_lock(&m->m_lock.atomic);
|
||||
ompi_atomic_lock(&m->m_lock_atomic);
|
||||
}
|
||||
|
||||
static inline void ompi_mutex_unlock(ompi_mutex_t *m)
|
||||
{
|
||||
ompi_atomic_unlock(&m->m_lock.atomic);
|
||||
ompi_atomic_unlock(&m->m_lock_atomic);
|
||||
}
|
||||
|
||||
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user