1
1
openmpi/src/threads/mutex_pthread.h
David Daniel 927ef83454 This is a large check-in related to switching from
os/atomic.h  -->  include/sys/atomic.h

WARNING:  There are almost certainly some bugs introduced here, but I
believe that using this system will get us to a stable and portable
library faster in the long run.

Other changes:

threads/mutex

  Reorganized to use pthreads or asm atomic operations as available.
  Untested Windows implementation added using InterlockedExchange() funcion.

threads/thread

  Added an untested Windows implementation

other places

  Updates to include the "right" header files or to use
  ompi_atomic_add_int() rather that fetchNadd() etc.

This commit was SVN r2221.
2004-08-18 23:24:27 +00:00

41 строка
637 B
C

/*
* $HEADER$
*/
#ifndef _OMPI_MUTEX_PTHREAD_
#define _OMPI_MUTEX_PTHREAD_
#include <pthread.h>
#include "class/ompi_object.h"
#include "include/sys/atomic.h"
struct ompi_mutex_t {
ompi_object_t super;
pthread_mutex_t m_lock;
};
typedef struct ompi_mutex_t ompi_mutex_t;
OBJ_CLASS_DECLARATION(ompi_mutex_t);
static inline void ompi_mutex_lock(ompi_mutex_t* m)
{
pthread_mutex_lock(&m->m_lock);
}
static inline int ompi_mutex_trylock(ompi_mutex_t* m)
{
return pthread_mutex_trylock(&m->m_lock);
}
static inline void ompi_mutex_unlock(ompi_mutex_t* m)
{
pthread_mutex_unlock(&m->m_lock);
}
#endif