I’m making a thread class to use as a wrapper for pthreads. I have a Queue class to use as a queue, but I’m having trouble with it. It seems to allocate and fill the queue struct fine, but when I try to get the data from it, it Seg. faults.
http://pastebin.com/Bquqzxt0 (the printf’s are for debugging, both throw seg faults)
edit: the queue is stored in a dynamically allocated “struct queueset” array as a pointer to the data and an index for the data
C++ provides a built-in queue class for you:
In C++, the best way to avoid memory problems is to minimize the management of memory using raw pointers as much as possible, and use standard classes where applicable.