1
1

A quick fix for opal only apps (really this time)

This commit was SVN r17537.
Этот коммит содержится в:
Josh Hursey 2008-02-20 22:33:42 +00:00
родитель ad9fbf2a92
Коммит a169575ab2

Просмотреть файл

@ -109,6 +109,7 @@ int opal_cr_checkpoint_request = OPAL_CR_STATUS_NONE;
* Threading Functions and Variables * Threading Functions and Variables
*****************/ *****************/
static void* opal_cr_thread_fn(opal_object_t *obj); static void* opal_cr_thread_fn(opal_object_t *obj);
bool opal_cr_thread_is_done = false;
bool opal_cr_thread_is_active = false; bool opal_cr_thread_is_active = false;
bool opal_cr_thread_in_library = false; bool opal_cr_thread_in_library = false;
bool opal_cr_thread_use_if_avail = true; bool opal_cr_thread_use_if_avail = true;
@ -336,9 +337,10 @@ int opal_cr_init(void )
OBJ_CONSTRUCT(&opal_cr_thread, opal_thread_t); OBJ_CONSTRUCT(&opal_cr_thread, opal_thread_t);
OBJ_CONSTRUCT(&opal_cr_thread_lock, opal_mutex_t); OBJ_CONSTRUCT(&opal_cr_thread_lock, opal_mutex_t);
opal_cr_thread_is_done = false;
opal_cr_thread_is_active = false; opal_cr_thread_is_active = false;
opal_cr_thread_num_in_library = 0;
opal_cr_thread_in_library = false; opal_cr_thread_in_library = false;
opal_cr_thread_num_in_library = 0;
opal_cr_thread.t_run = opal_cr_thread_fn; opal_cr_thread.t_run = opal_cr_thread_fn;
opal_cr_thread.t_arg = NULL; opal_cr_thread.t_arg = NULL;
@ -369,6 +371,7 @@ int opal_cr_finalize(void)
/* /*
* Stop the thread * Stop the thread
*/ */
opal_cr_thread_is_done = true;
opal_cr_thread_is_active = false; opal_cr_thread_is_active = false;
opal_cr_thread_in_library = true; opal_cr_thread_in_library = true;
@ -1129,10 +1132,14 @@ static void* opal_cr_thread_fn(opal_object_t *obj)
/* /*
* Wait to become active * Wait to become active
*/ */
while( !opal_cr_thread_is_active ) { while( !opal_cr_thread_is_active && !opal_cr_thread_is_done) {
sched_yield(); sched_yield();
} }
if( opal_cr_thread_is_done ) {
return NULL;
}
/* /*
* While active * While active
*/ */
@ -1175,6 +1182,7 @@ void opal_cr_thread_init_library(void)
} else { } else {
/* Activate the CR Thread */ /* Activate the CR Thread */
opal_cr_thread_in_library = false; opal_cr_thread_in_library = false;
opal_cr_thread_is_done = false;
opal_cr_thread_is_active = true; opal_cr_thread_is_active = true;
} }
} }
@ -1186,6 +1194,7 @@ void opal_cr_thread_finalize_library(void)
} else { } else {
/* Deactivate the CR Thread */ /* Deactivate the CR Thread */
opal_cr_thread_is_active = false; opal_cr_thread_is_active = false;
opal_cr_thread_is_done = true;
opal_cr_thread_in_library = true; opal_cr_thread_in_library = true;
} }
} }
@ -1197,6 +1206,7 @@ void opal_cr_thread_abort_library(void)
} else { } else {
/* Deactivate the CR Thread */ /* Deactivate the CR Thread */
opal_cr_thread_is_active = false; opal_cr_thread_is_active = false;
opal_cr_thread_is_done = true;
opal_cr_thread_in_library = true; opal_cr_thread_in_library = true;
} }
} }