1
1

Improvement on Josh's fix for big endian 64 bit machines. Add macro

for atomically adding to a size_t.  macro will figure out whether
size_t is 32 or 64 bit and use the right atomic add.  

This commit was SVN r6205.
Этот коммит содержится в:
Brian Barrett 2005-06-28 20:15:01 +00:00
родитель 94d097430e
Коммит db58b61ffa
2 изменённых файлов: 16 добавлений и 2 удалений

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

@ -58,7 +58,7 @@ static inline void mca_ptl_base_send_request_offset(
mca_ptl_base_send_request_t* request, mca_ptl_base_send_request_t* request,
size_t offset) size_t offset)
{ {
OMPI_THREAD_ADD32((size_t*)(&request->req_offset), offset); OMPI_THREAD_ADD_SIZE_T((&request->req_offset), offset);
} }

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

@ -258,11 +258,25 @@ static inline bool ompi_set_using_threads(bool have)
#if OMPI_HAVE_THREAD_SUPPORT #if OMPI_HAVE_THREAD_SUPPORT
#define OMPI_THREAD_ADD64(x,y) \ #define OMPI_THREAD_ADD64(x,y) \
((OMPI_HAVE_THREAD_SUPPORT && ompi_using_threads()) ? \ ((OMPI_HAVE_THREAD_SUPPORT && ompi_using_threads()) ? \
ompi_atomic_add_32(x,y) : (*x += y)) ompi_atomic_add_64(x,y) : (*x += y))
#else #else
#define OMPI_THREAD_ADD64(x,y) (*x += y) #define OMPI_THREAD_ADD64(x,y) (*x += y)
#endif #endif
#if OMPI_HAVE_THREAD_SUPPORT
#if OMPI_SIZEOF_SIZE_T == 4
#define OMPI_THREAD_ADD_SIZE_T(x,y) \
((OMPI_HAVE_THREAD_SUPPORT && ompi_using_threads()) ? \
ompi_atomic_add_32(x,y) : (*x += y))
#elif OMPI_SIZEOF_SIZE_T == 8
#define OMPI_THREAD_ADD_SIZE_T(x,y) \
((OMPI_HAVE_THREAD_SUPPORT && ompi_using_threads()) ? \
ompi_atomic_add_64(x,y) : (*x += y))
#endif
#else
#define OMPI_THREAD_ADD_SIZE_T(x,y) (*x += y)
#endif
/** /**
* Always locks a mutex (never compile- or run-time removed) * Always locks a mutex (never compile- or run-time removed)