1
1

Add OPAL_ATOMIC_CMPSET macros that became non atomic with only one threaded.

This commit was SVN r15720.
Этот коммит содержится в:
Gleb Natapov 2007-08-01 12:13:34 +00:00
родитель 9c20d67301
Коммит dd8b0c925f

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

@ -12,6 +12,8 @@
* Copyright (c) 2007 Cisco, Inc. All rights reserved.
* Copyright (c) 2007 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2007 Voltaire. All rights reserved.
*
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -377,6 +379,31 @@ opal_thread_debug_trylock(opal_mutex_t *mutex, char *file, int line)
#define OPAL_THREAD_ADD_SIZE_T(x,y) (*x += y)
#endif
#if OMPI_HAVE_THREAD_SUPPORT
# if OPAL_HAVE_ATOMIC_CMPSET_32
# define OPAL_ATOMIC_CMPSET_32(x, y, z) \
(opal_using_threads() ? opal_atomic_cmpset_32(x, y, z) : ((*(x) = (z)), 1))
# endif
# if OPAL_HAVE_ATOMIC_CMPSET_64
# define OPAL_ATOMIC_CMPSET_64(x, y, z) \
(opal_using_threads() ? opal_atomic_cmpset_64(x, y, z) : ((*(x) = (z)), 1))
# endif
# if OPAL_HAVE_ATOMIC_CMPSET_32 || OPAL_HAVE_ATOMIC_CMPSET_64
# define OPAL_ATOMIC_CMPSET(x, y, z) \
(opal_using_threads() ? opal_atomic_cmpset(x, y, z) : ((*(x) = (z)), 1))
# endif
#else
# if OPAL_HAVE_ATOMIC_CMPSET_32
# define OPAL_ATOMIC_CMPSET_32(x, y, z) ((*(x) = (z)), 1)
# endif
# if OPAL_HAVE_ATOMIC_CMPSET_64
# define OPAL_ATOMIC_CMPSET_64(x, y, z) ((*(x) = (z)), 1)
# endif
# if OPAL_HAVE_ATOMIC_CMPSET_32 || OPAL_HAVE_ATOMIC_CMPSET_64
# define OPAL_ATOMIC_CMPSET(x, y, z) ((*(x) = (z)), 1)
# endif
#endif
END_C_DECLS
#endif /* OPAL_MUTEX_H */