1
1

Merge pull request #5754 from gpaulsen/event_threading

opal/progress: protect against multiple threads in event base
Этот коммит содержится в:
Geoff Paulsen 2018-09-22 15:00:32 -05:00 коммит произвёл GitHub
родитель bc798b6135 cd88e307fd
Коммит 556367af31
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23

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

@ -10,7 +10,7 @@
* University of Stuttgart. All rights reserved. * University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California. * Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved. * All rights reserved.
* Copyright (c) 2006-2016 Los Alamos National Security, LLC. All rights * Copyright (c) 2006-2018 Los Alamos National Security, LLC. All rights
* reserved. * reserved.
* Copyright (c) 2015-2016 Research Organization for Information Science * Copyright (c) 2015-2016 Research Organization for Information Science
* and Technology (RIST). All rights reserved. * and Technology (RIST). All rights reserved.
@ -171,9 +171,10 @@ opal_progress_finalize(void)
static int opal_progress_events(void) static int opal_progress_events(void)
{ {
static volatile int32_t lock = 0;
int events = 0; int events = 0;
if( opal_progress_event_flag != 0 ) { if( opal_progress_event_flag != 0 && !OPAL_THREAD_SWAP_32(&lock, 1) ) {
#if OPAL_HAVE_WORKING_EVENTOPS #if OPAL_HAVE_WORKING_EVENTOPS
#if OPAL_PROGRESS_USE_TIMERS #if OPAL_PROGRESS_USE_TIMERS
#if OPAL_PROGRESS_ONLY_USEC_NATIVE #if OPAL_PROGRESS_ONLY_USEC_NATIVE
@ -201,6 +202,7 @@ static int opal_progress_events(void)
#endif /* OPAL_PROGRESS_USE_TIMERS */ #endif /* OPAL_PROGRESS_USE_TIMERS */
#endif /* OPAL_HAVE_WORKING_EVENTOPS */ #endif /* OPAL_HAVE_WORKING_EVENTOPS */
lock = 0;
} }
return events; return events;