#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<struct Item> *queue = QFactory::createQueue<struct Item> (1, 10);
|
|
LockFreeQueue<struct Item> *queue = QueueFactory::createQueue<struct Item> (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);
|
}
|