Thanks, have implemented those makros into BGMN. In principle, Linux should have a better multithreading compared to Windows, time to request plus release a mutex: WIN 3300ns Linux 1200ns But why the hell is WIN better in those macros: WIN InterlockedDecrement 64ns LINUX (((int)AO_fetch_and_sub1(...))-1) 256ns Bad implementation? Phenom 2,4GHz, Windows XP x86: Watcom 1.7a Fedora 9 x86: gcc 4.3.0 with -O3 Joerg Bergmann Kevin Kofler schrieb:
Joerg Bergmann wrote:Thanks. I do not need atomic counters. I need only the counter to be set to its new value before setting the boolean. But, as I have learned from parallel programming: If one needs atomic counters, he mostly needs atomic increase-and-check or atomic decrease-and-check. But that functions seem not to be provided by atomic.h. Are they provided elsewhere? Simple atomic increases or atomic decreases are without need, in most cases.http://gcc.gnu.org/onlinedocs/gcc-4.3.2/gcc/Atomic-Builtins.html Kevin Kofler