* remove unused condition variable files (everything is in condition.{h,c}
these days). Always in SVN history if we want them back. This commit was SVN r8199.
Этот коммит содержится в:
родитель
e5cb127830
Коммит
1358781bd8
@ -1,41 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
||||
* University Research and Technology
|
||||
* Corporation. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The University of Tennessee and The University
|
||||
* of Tennessee Research Foundation. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
||||
* University of Stuttgart. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
#include "ompi_config.h"
|
||||
|
||||
#include "opal/threads/mutex.h"
|
||||
#include "opal/threads/condition.h"
|
||||
|
||||
#if OMPI_HAVE_POSIX_THREADS && OMPI_ENABLE_PROGRESS_THREADS
|
||||
|
||||
static void opal_condition_construct(opal_condition_t *c)
|
||||
{
|
||||
pthread_cond_init(&c->c_cond, NULL);
|
||||
}
|
||||
|
||||
static void opal_condition_destruct(opal_condition_t *c)
|
||||
{
|
||||
pthread_cond_destroy(&c->c_cond);
|
||||
}
|
||||
|
||||
OBJ_CLASS_INSTANCE(opal_condition_t,
|
||||
opal_object_t,
|
||||
opal_condition_construct,
|
||||
opal_condition_destruct);
|
||||
|
||||
#endif
|
@ -1,64 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
||||
* University Research and Technology
|
||||
* Corporation. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The University of Tennessee and The University
|
||||
* of Tennessee Research Foundation. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
||||
* University of Stuttgart. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
#ifndef OMPI_CONDITION_PTHREAD_H
|
||||
#define OMPI_CONDITION_PTHREAD_H
|
||||
|
||||
#ifdef HAVE_PTHREAD_H
|
||||
#include <pthread.h>
|
||||
#endif
|
||||
#include "opal/threads/mutex.h"
|
||||
|
||||
#if defined(c_plusplus) || defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
struct opal_condition_t {
|
||||
opal_object_t super;
|
||||
pthread_cond_t c_cond;
|
||||
};
|
||||
typedef struct opal_condition_t opal_condition_t;
|
||||
|
||||
OMPI_DECLSPEC OBJ_CLASS_DECLARATION(opal_condition_t);
|
||||
|
||||
|
||||
static inline int opal_condition_wait(opal_condition_t *c, opal_mutex_t *m)
|
||||
{
|
||||
return pthread_cond_wait(&c->c_cond, &m->m_lock_pthread);
|
||||
}
|
||||
|
||||
static inline int opal_condition_timedwait(opal_condition_t *c,
|
||||
opal_mutex_t *m,
|
||||
const struct timespec *abstime)
|
||||
{
|
||||
return pthread_cond_timedwait(&c->c_cond, &m->m_lock_pthread, abstime);
|
||||
}
|
||||
|
||||
static inline int opal_condition_signal(opal_condition_t *c)
|
||||
{
|
||||
return pthread_cond_signal(&c->c_cond);
|
||||
}
|
||||
|
||||
static inline int opal_condition_broadcast(opal_condition_t *c)
|
||||
{
|
||||
return pthread_cond_broadcast(&c->c_cond);
|
||||
}
|
||||
|
||||
#if defined(c_plusplus) || defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
@ -1,43 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
||||
* University Research and Technology
|
||||
* Corporation. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The University of Tennessee and The University
|
||||
* of Tennessee Research Foundation. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
||||
* University of Stuttgart. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
#include "ompi_config.h"
|
||||
|
||||
#include "opal/threads/mutex.h"
|
||||
#include "opal/threads/condition.h"
|
||||
|
||||
#if (OMPI_HAVE_POSIX_THREADS == 0) || (OMPI_ENABLE_PROGRESS_THREADS == 0)
|
||||
|
||||
static void opal_condition_construct(opal_condition_t *c)
|
||||
{
|
||||
c->c_waiting = 0;
|
||||
c->c_signaled = 0;
|
||||
}
|
||||
|
||||
|
||||
static void opal_condition_destruct(opal_condition_t *c)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
OBJ_CLASS_INSTANCE(opal_condition_t,
|
||||
opal_object_t,
|
||||
opal_condition_construct,
|
||||
opal_condition_destruct);
|
||||
|
||||
#endif
|
@ -1,114 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
||||
* University Research and Technology
|
||||
* Corporation. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The University of Tennessee and The University
|
||||
* of Tennessee Research Foundation. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
||||
* University of Stuttgart. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
#ifndef OMPI_CONDITION_SPINLOCK_H
|
||||
#define OMPI_CONDITION_SPINLOCK_H
|
||||
|
||||
#include "ompi_config.h"
|
||||
#ifdef HAVE_SYS_TIME_H
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
#include "opal/threads/condition.h"
|
||||
#include "opal/threads/mutex.h"
|
||||
#include "opal/runtime/opal_progress.h"
|
||||
|
||||
#if defined(c_plusplus) || defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
struct opal_condition_t {
|
||||
opal_object_t super;
|
||||
volatile int c_waiting;
|
||||
volatile int c_signaled;
|
||||
};
|
||||
typedef struct opal_condition_t opal_condition_t;
|
||||
|
||||
OMPI_DECLSPEC OBJ_CLASS_DECLARATION(opal_condition_t);
|
||||
|
||||
|
||||
static inline int opal_condition_wait(opal_condition_t *c, opal_mutex_t *m)
|
||||
{
|
||||
c->c_waiting++;
|
||||
if (opal_using_threads()) {
|
||||
while (c->c_signaled == 0) {
|
||||
opal_mutex_unlock(m);
|
||||
opal_progress();
|
||||
opal_mutex_lock(m);
|
||||
}
|
||||
} else {
|
||||
while (c->c_signaled == 0) {
|
||||
opal_progress();
|
||||
}
|
||||
}
|
||||
c->c_signaled--;
|
||||
c->c_waiting--;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int opal_condition_timedwait(opal_condition_t *c,
|
||||
opal_mutex_t *m,
|
||||
const struct timespec *abstime)
|
||||
{
|
||||
struct timeval tv;
|
||||
struct timeval abs;
|
||||
abs.tv_sec = abstime->tv_sec;
|
||||
abs.tv_usec = abstime->tv_nsec / 1000;
|
||||
gettimeofday(&tv,NULL);
|
||||
|
||||
c->c_waiting++;
|
||||
if (opal_using_threads()) {
|
||||
while (c->c_signaled == 0 &&
|
||||
(tv.tv_sec <= abs.tv_sec ||
|
||||
(tv.tv_sec == abs.tv_sec && tv.tv_usec < abs.tv_usec))) {
|
||||
opal_mutex_unlock(m);
|
||||
opal_progress();
|
||||
gettimeofday(&tv,NULL);
|
||||
opal_mutex_lock(m);
|
||||
}
|
||||
} else {
|
||||
while (c->c_signaled == 0 &&
|
||||
(tv.tv_sec <= abs.tv_sec ||
|
||||
(tv.tv_sec == abs.tv_sec && tv.tv_usec < abs.tv_usec))) {
|
||||
opal_progress();
|
||||
gettimeofday(&tv,NULL);
|
||||
}
|
||||
}
|
||||
c->c_signaled--;
|
||||
c->c_waiting--;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int opal_condition_signal(opal_condition_t *c)
|
||||
{
|
||||
if (c->c_waiting) {
|
||||
c->c_signaled++;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int opal_condition_broadcast(opal_condition_t *c)
|
||||
{
|
||||
c->c_signaled += c->c_waiting;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if defined(c_plusplus) || defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
Загрузка…
Ссылка в новой задаче
Block a user