#include #include #include "support.h" #include "include/constants.h" #include "threads/thread.h" #include "threads/condition.h" #include "os/atomic.h" ompi_mutex_t mutex; ompi_condition_t thr1_cond; ompi_condition_t thr2_cond; int thr1_count = 0; int thr2_count = 0; #define TEST_COUNT 1000000 static void* thr1_run(ompi_object_t* obj) { int i; clock_t c1, c2; ompi_mutex_lock(&mutex); c1 = clock(); for(i=0; it_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); test_verify_int(TEST_COUNT, thr1_count); rc = ompi_thread_join(thr2, NULL); test_verify_int(OMPI_SUCCESS, rc); test_verify_int(TEST_COUNT, thr2_count); test_finalize(); return 0; }