Looking for critique of my thread safe, lock-free queue implementation
So, I've written a queue, after a bit of research. It uses a fixed-size buffer, so it's a circular queue. It has to be thread-safe, and I've tried to make it lock-free. I'd like to know what's wrong with it, because these kinds of things are difficult to predict on my own. Here's the header: template <class T> class LockFreeQueue { public: LockFreeQueue(uint buffersize) : buffer(NULL), ifront1(0), ifront2(0), iback1(0), iback2(0), size(buffersize) { buffer = new atomic <T>[buffersize]; } ~LockFreeQueue(void) { if (buffer) delete[] buffer; } bool pop(T* output); bool push(T input); private: