#include "test.h" using namespace std; int key = 1; void sigint_handler(int sig) { destroy(key); exit(0); } int main(int argc, char *argv[]) { int qsize = 16; signal(SIGINT, sigint_handler); /* Get IDs for semaphore set and shared memory created by writer */ //SAbstractQueue *queue = QFactory::createQueue (1, 10); LockFreeQueue *queue = QueueFactory::createQueue (key, qsize); /* Transfer blocks of data from shared memory to stdout */ struct timespec timeout = {10, 0}; struct Item item; while(queue->pop(item)) { cout << item.pic << endl; //sleep(1); } destroy(key); cerr << "consumer quit" << endl; exit(EXIT_SUCCESS); }