1
1
openmpi/test/threads/ompi_thread.c
Brian Barrett 897983ea30 * Fix regression in ompi_argv_delete exposed with the unit tests
* Update a bunch of the unit tests to either be disabled (someone who
  isn't me and knows that code needs to fix them) or to work properly

This commit was SVN r4986.
2005-03-22 14:41:45 +00:00

55 строки
1007 B
C

#include "ompi_config.h"
#include "support.h"
#include "include/constants.h"
#include "threads/thread.h"
#include "include/sys/atomic.h"
static volatile int count = 0;
static void* thr1_run(ompi_object_t* obj)
{
ompi_atomic_add(&count, 1);
return NULL;
}
static void* thr2_run(ompi_object_t* obj)
{
ompi_atomic_add(&count, 2);
return NULL;
}
int main(int argc, char** argv)
{
int rc;
ompi_thread_t thr1;
ompi_thread_t thr2;
test_init("ompi_thread_t");
OBJ_CONSTRUCT(&thr1, ompi_thread_t);
OBJ_CONSTRUCT(&thr2, ompi_thread_t);
thr1.t_run = thr1_run;
thr2.t_run = thr2_run;
rc = ompi_thread_start(&thr1);
test_verify_int(OMPI_SUCCESS, rc);
rc = ompi_thread_start(&thr2);
test_verify_int(OMPI_SUCCESS, rc);
rc = ompi_thread_join(&thr1, NULL);
test_verify_int(OMPI_SUCCESS, rc);
rc = ompi_thread_join(&thr2, NULL);
test_verify_int(OMPI_SUCCESS, rc);
test_verify_int(3, count);
return test_finalize();
}