Mercurial > hg > freeDiameter
diff include/freeDiameter/libfreeDiameter.h @ 454:f1484823cb4a
Small hack which might spear some concurrency problems and is quite harmless
author | Sebastien Decugis <sdecugis@nict.go.jp> |
---|---|
date | Thu, 29 Jul 2010 16:11:12 +0900 |
parents | 9a8b3178a7a7 |
children | 16224de837fd |
line wrap: on
line diff
--- a/include/freeDiameter/libfreeDiameter.h Thu Jul 29 15:32:08 2010 +0900 +++ b/include/freeDiameter/libfreeDiameter.h Thu Jul 29 16:11:12 2010 +0900 @@ -568,6 +568,14 @@ return 0; } +/* Force flushing the cache of a CPU before reading a shared memory area (use only for atomic reads such as int and void*) */ +extern pthread_mutex_t fd_cpu_mtx_dummy; /* only for the macro bellow, so that we have reasonably fresh pir_state value when needed */ +#define fd_cpu_flush_cache() { \ + (void)pthread_mutex_lock(&fd_cpu_mtx_dummy); \ + (void)pthread_mutex_unlock(&fd_cpu_mtx_dummy); \ +} + + /************* Cancelation cleanup handlers for common objects *************/