lockfree

Is multiple-producer, single-consumer possible in a lockfree setting?

I have a bunch of threads that are doing lots of communication with each other. I would prefer this be lock free. For each thread, I want to have a mailbox, where other threads can send it messages, (but only the owner can remove messages). This is a multiple-producer single-consumer situation. is it possible for me to do this in a lock...

How to do compare and increment atomically in C/C++

In my attempt to develope a thread-safe c++ weak pointer template class, I need to check a flag that indicating the object is still alive, if yes then increment the object's reference count and I need to do the both steps atomically. I know the existance of intrinsics functions provided by the compiler for instance _InterlockedCompareExc...