1
1

force locking regardless of build type

This commit was SVN r6157.
Этот коммит содержится в:
Tim Woodall 2005-06-23 20:51:16 +00:00
родитель a77845f8e6
Коммит e79124aece
3 изменённых файлов: 22 добавлений и 22 удалений

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

@ -218,13 +218,13 @@ static void* ompi_event_run(ompi_object_t* arg)
#endif #endif
#if OMPI_ENABLE_PROGRESS_THREADS #if OMPI_ENABLE_PROGRESS_THREADS
OMPI_THREAD_LOCK(&ompi_event_lock); ompi_mutex_lock(&ompi_event_lock);
ompi_event_del_i(&ompi_event_pipe_event); ompi_event_del_i(&ompi_event_pipe_event);
close(ompi_event_pipe[0]); close(ompi_event_pipe[0]);
close(ompi_event_pipe[1]); close(ompi_event_pipe[1]);
ompi_event_pipe[0] = -1; ompi_event_pipe[0] = -1;
ompi_event_pipe[1] = -1; ompi_event_pipe[1] = -1;
OMPI_THREAD_UNLOCK(&ompi_event_lock); ompi_mutex_unlock(&ompi_event_lock);
#endif #endif
return NULL; return NULL;
} }
@ -289,9 +289,9 @@ int ompi_event_disable(void)
{ {
#if OMPI_ENABLE_PROGRESS_THREADS #if OMPI_ENABLE_PROGRESS_THREADS
if(ompi_using_threads()) { if(ompi_using_threads()) {
OMPI_THREAD_LOCK(&ompi_event_lock); ompi_mutex_lock(&ompi_event_lock);
if(ompi_event_inited > 0 && ompi_event_enabled == false) { if(ompi_event_inited > 0 && ompi_event_enabled == false) {
OMPI_THREAD_UNLOCK(&ompi_event_lock); ompi_mutex_unlock(&ompi_event_lock);
return OMPI_SUCCESS; return OMPI_SUCCESS;
} }
@ -302,7 +302,7 @@ int ompi_event_disable(void)
ompi_output(0, "ompi_event_add: write() to ompi_event_pipe[1] failed with errno=%d\n", errno); ompi_output(0, "ompi_event_add: write() to ompi_event_pipe[1] failed with errno=%d\n", errno);
ompi_event_pipe_signalled++; ompi_event_pipe_signalled++;
} }
OMPI_THREAD_UNLOCK(&ompi_event_lock); ompi_mutex_unlock(&ompi_event_lock);
ompi_thread_join(&ompi_event_thread, NULL); ompi_thread_join(&ompi_event_thread, NULL);
} else { } else {
ompi_event_enabled = false; ompi_event_enabled = false;
@ -319,16 +319,16 @@ int ompi_event_enable(void)
if(ompi_using_threads()) { if(ompi_using_threads()) {
int rc; int rc;
OMPI_THREAD_LOCK(&ompi_event_lock); ompi_mutex_lock(&ompi_event_lock);
if(ompi_event_inited > 0 && ompi_event_enabled == true) { if(ompi_event_inited > 0 && ompi_event_enabled == true) {
OMPI_THREAD_UNLOCK(&ompi_event_lock); ompi_mutex_unlock(&ompi_event_lock);
return OMPI_SUCCESS; return OMPI_SUCCESS;
} }
/* create a pipe to signal the event thread */ /* create a pipe to signal the event thread */
if(pipe(ompi_event_pipe) != 0) { if(pipe(ompi_event_pipe) != 0) {
ompi_output(0, "ompi_event_init: pipe() failed with errno=%d\n", errno); ompi_output(0, "ompi_event_init: pipe() failed with errno=%d\n", errno);
OMPI_THREAD_UNLOCK(&ompi_event_lock); ompi_mutex_unlock(&ompi_event_lock);
return OMPI_ERROR; return OMPI_ERROR;
} }
@ -347,10 +347,10 @@ int ompi_event_enable(void)
ompi_event_enabled = true; ompi_event_enabled = true;
ompi_event_thread.t_run = ompi_event_run; ompi_event_thread.t_run = ompi_event_run;
if((rc = ompi_thread_start(&ompi_event_thread)) != OMPI_SUCCESS) { if((rc = ompi_thread_start(&ompi_event_thread)) != OMPI_SUCCESS) {
OMPI_THREAD_UNLOCK(&ompi_event_lock); ompi_mutex_unlock(&ompi_event_lock);
return rc; return rc;
} }
OMPI_THREAD_UNLOCK(&ompi_event_lock); ompi_mutex_unlock(&ompi_event_lock);
} else { } else {
ompi_event_pipe[0] = -1; ompi_event_pipe[0] = -1;
ompi_event_pipe[1] = -1; ompi_event_pipe[1] = -1;
@ -366,7 +366,7 @@ int ompi_event_restart(void)
{ {
int rc; int rc;
#if OMPI_ENABLE_PROGRESS_THREADS #if OMPI_ENABLE_PROGRESS_THREADS
OMPI_THREAD_LOCK(&ompi_event_lock); ompi_mutex_lock(&ompi_event_lock);
if(ompi_event_pipe[0] >= 0) { if(ompi_event_pipe[0] >= 0) {
ompi_event_del_i(&ompi_event_pipe_event); ompi_event_del_i(&ompi_event_pipe_event);
/* do not close pipes - in case of bproc_vrfork they are not open /* do not close pipes - in case of bproc_vrfork they are not open
@ -376,7 +376,7 @@ int ompi_event_restart(void)
ompi_event_pipe[1] = -1; ompi_event_pipe[1] = -1;
} }
ompi_event_enabled = false; ompi_event_enabled = false;
OMPI_THREAD_UNLOCK(&ompi_event_lock); ompi_mutex_unlock(&ompi_event_lock);
#endif #endif
ompi_event_enable(); ompi_event_enable();
@ -436,13 +436,13 @@ ompi_event_loop(int flags)
return(0); return(0);
if(ompi_using_threads()) { if(ompi_using_threads()) {
OMPI_THREAD_LOCK(&ompi_event_lock); ompi_mutex_lock(&ompi_event_lock);
} }
/* Calculate the initial events that we are waiting for */ /* Calculate the initial events that we are waiting for */
if (ompi_evsel->recalc && ompi_evsel->recalc(ompi_evbase, 0) == -1) { if (ompi_evsel->recalc && ompi_evsel->recalc(ompi_evbase, 0) == -1) {
ompi_output(0, "ompi_event_loop: ompi_evsel->recalc() failed."); ompi_output(0, "ompi_event_loop: ompi_evsel->recalc() failed.");
OMPI_THREAD_UNLOCK(&ompi_event_lock); ompi_mutex_unlock(&ompi_event_lock);
return (-1); return (-1);
} }
@ -455,7 +455,7 @@ ompi_event_loop(int flags)
if (res == -1) { if (res == -1) {
ompi_output(0, "ompi_event_loop: ompi_event_sigcb() failed."); ompi_output(0, "ompi_event_loop: ompi_event_sigcb() failed.");
errno = EINTR; errno = EINTR;
OMPI_THREAD_UNLOCK(&ompi_event_lock); ompi_mutex_unlock(&ompi_event_lock);
return (-1); return (-1);
} }
} }
@ -476,7 +476,7 @@ ompi_event_loop(int flags)
#endif #endif
if (res == -1) { if (res == -1) {
ompi_output(0, "ompi_event_loop: ompi_evesel->dispatch() failed."); ompi_output(0, "ompi_event_loop: ompi_evesel->dispatch() failed.");
OMPI_THREAD_UNLOCK(&ompi_event_lock); ompi_mutex_unlock(&ompi_event_lock);
return (-1); return (-1);
} }
@ -506,11 +506,11 @@ ompi_event_loop(int flags)
if (ompi_evsel->recalc && ompi_evsel->recalc(ompi_evbase, 0) == -1) { if (ompi_evsel->recalc && ompi_evsel->recalc(ompi_evbase, 0) == -1) {
ompi_output(0, "ompi_event_loop: ompi_evesel->recalc() failed."); ompi_output(0, "ompi_event_loop: ompi_evesel->recalc() failed.");
OMPI_THREAD_UNLOCK(&ompi_event_lock); ompi_mutex_unlock(&ompi_event_lock);
return (-1); return (-1);
} }
} }
OMPI_THREAD_UNLOCK(&ompi_event_lock); ompi_mutex_unlock(&ompi_event_lock);
return (num_active); return (num_active);
} }

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

@ -192,9 +192,9 @@ poll_dispatch(void *arg, struct timeval *tv)
#endif #endif
sec = tv->tv_sec * 1000 + tv->tv_usec / 1000; sec = tv->tv_sec * 1000 + tv->tv_usec / 1000;
OMPI_THREAD_UNLOCK(&ompi_event_lock); ompi_mutex_unlock(&ompi_event_lock);
res = poll(pop->event_set, nfds, sec); res = poll(pop->event_set, nfds, sec);
OMPI_THREAD_LOCK(&ompi_event_lock); ompi_mutex_lock(&ompi_event_lock);
#if OMPI_EVENT_USE_SIGNALS #if OMPI_EVENT_USE_SIGNALS
if (ompi_evsignal_recalc(&pop->evsigmask) == -1) if (ompi_evsignal_recalc(&pop->evsigmask) == -1)

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

@ -199,10 +199,10 @@ select_dispatch(void *arg, struct timeval *tv)
#endif #endif
/* release lock while waiting in kernel */ /* release lock while waiting in kernel */
OMPI_THREAD_UNLOCK(&ompi_event_lock); ompi_mutex_unlock(&ompi_event_lock);
res = select(sop->event_fds + 1, sop->event_readset, res = select(sop->event_fds + 1, sop->event_readset,
sop->event_writeset, NULL, tv); sop->event_writeset, NULL, tv);
OMPI_THREAD_LOCK(&ompi_event_lock); ompi_mutex_lock(&ompi_event_lock);
#if OMPI_EVENT_USE_SIGNALS #if OMPI_EVENT_USE_SIGNALS
if (ompi_evsignal_recalc(&sop->evsigmask) == -1) if (ompi_evsignal_recalc(&sop->evsigmask) == -1)