2003-12-22 19:29:21 +03:00
|
|
|
/*
|
2005-11-05 22:57:48 +03:00
|
|
|
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
|
|
|
* University Research and Technology
|
|
|
|
* Corporation. All rights reserved.
|
2006-08-23 04:29:35 +04:00
|
|
|
* Copyright (c) 2004-2006 The University of Tennessee and The University
|
2005-11-05 22:57:48 +03:00
|
|
|
* of Tennessee Research Foundation. All rights
|
|
|
|
* reserved.
|
2004-11-28 23:09:25 +03:00
|
|
|
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
|
|
|
* University of Stuttgart. All rights reserved.
|
2005-03-24 15:43:37 +03:00
|
|
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
|
|
|
* All rights reserved.
|
2004-11-22 04:38:40 +03:00
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
2004-01-07 11:02:26 +03:00
|
|
|
* $HEADER$
|
2003-12-22 19:29:21 +03:00
|
|
|
*/
|
2004-01-07 21:39:35 +03:00
|
|
|
|
2005-07-04 02:45:48 +04:00
|
|
|
#ifndef OPAL_THREAD_H
|
|
|
|
#define OPAL_THREAD_H 1
|
2003-12-22 19:29:21 +03:00
|
|
|
|
2006-08-23 03:55:33 +04:00
|
|
|
#if OMPI_HAVE_POSIX_THREADS
|
2004-03-03 19:10:26 +03:00
|
|
|
#include <pthread.h>
|
2005-02-16 18:38:37 +03:00
|
|
|
#elif OMPI_HAVE_SOLARIS_THREADS
|
|
|
|
#include <thread.h>
|
2004-10-20 05:03:09 +04:00
|
|
|
#endif
|
2004-08-19 03:24:27 +04:00
|
|
|
|
2005-07-03 20:06:07 +04:00
|
|
|
#include "opal/class/opal_object.h"
|
2006-08-23 04:29:35 +04:00
|
|
|
|
2004-10-21 02:31:03 +04:00
|
|
|
#if defined(c_plusplus) || defined(__cplusplus)
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
2003-12-22 19:29:21 +03:00
|
|
|
|
2005-07-04 02:45:48 +04:00
|
|
|
typedef void *(*opal_thread_fn_t) (opal_object_t *);
|
2004-03-03 19:10:26 +03:00
|
|
|
|
|
|
|
|
2005-07-04 02:45:48 +04:00
|
|
|
struct opal_thread_t {
|
2005-07-03 20:06:07 +04:00
|
|
|
opal_object_t super;
|
2005-07-04 02:45:48 +04:00
|
|
|
opal_thread_fn_t t_run;
|
2004-10-27 17:50:27 +04:00
|
|
|
void* t_arg;
|
2005-12-13 01:01:51 +03:00
|
|
|
#ifdef __WINDOWS__
|
2004-08-19 03:24:27 +04:00
|
|
|
HANDLE t_handle;
|
|
|
|
#elif OMPI_HAVE_POSIX_THREADS
|
2004-03-03 19:10:26 +03:00
|
|
|
pthread_t t_handle;
|
2004-11-15 23:03:14 +03:00
|
|
|
#elif OMPI_HAVE_SOLARIS_THREADS
|
|
|
|
thread_t t_handle;
|
2004-08-19 03:24:27 +04:00
|
|
|
#endif
|
2004-03-03 19:10:26 +03:00
|
|
|
};
|
2004-08-19 03:24:27 +04:00
|
|
|
|
2005-07-04 02:45:48 +04:00
|
|
|
typedef struct opal_thread_t opal_thread_t;
|
2004-03-03 19:10:26 +03:00
|
|
|
|
2006-08-20 19:54:04 +04:00
|
|
|
OPAL_DECLSPEC OBJ_CLASS_DECLARATION(opal_thread_t);
|
2003-12-22 19:29:21 +03:00
|
|
|
|
2006-08-23 04:29:35 +04:00
|
|
|
OPAL_DECLSPEC int opal_thread_start(opal_thread_t *);
|
|
|
|
OPAL_DECLSPEC int opal_thread_join(opal_thread_t *, void **thread_return);
|
|
|
|
OPAL_DECLSPEC bool opal_thread_self_compare(opal_thread_t*);
|
|
|
|
OPAL_DECLSPEC opal_thread_t *opal_thread_get_self(void);
|
2006-08-20 19:54:04 +04:00
|
|
|
|
2004-10-21 02:31:03 +04:00
|
|
|
#if defined(c_plusplus) || defined(__cplusplus)
|
|
|
|
}
|
|
|
|
#endif
|
2003-12-22 19:29:21 +03:00
|
|
|
|
2005-07-04 02:45:48 +04:00
|
|
|
#endif /* OPAL_THREAD_H */
|