void* InterlockedExchangePointer(void** target, void* value) //Based on TBCOOL's suggestion //don't think it works as expected now { __asm__ __volatile__ ( " lock\n" " xchgl %1,%0\n" : "=a" (**target), "=b" (*value) : "a" (**target), "b" (*value) : "%ebx", "%eax", "memory" ); return value; }