| | |
| | | } |
| | | |
| | | |
| | | // void testArr(unsigned size) { |
| | | // unsigned int i = 0; |
| | | // int key = 2; |
| | | |
| | | // char item[size]; |
| | | |
| | | // size_t qsize = 16; |
| | | // //LockFreeQueue<struct Item> *queue = QueueFactory::createQueue<struct Item> (key, qsize); |
| | | // SHMQueue<char[size]> *queue = new SHMQueue<char[size]>(key, 16); |
| | | // // LockFreeQueue<struct Item> queue(16); |
| | | // for(i = 0; i < qsize; i++) { |
| | | // sprintf(item, "%d hello", i); |
| | | // if(queue->push(item)) { |
| | | // cout << i << " push:" << item << endl; |
| | | // } |
| | | // } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | // struct timespec timeout = {1, 0}; |
| | | |
| | | // i = 0; |
| | | // while((queue->pop_timeout(item, &timeout)) ) { |
| | | // cout << i << " pop:" << item << endl; |
| | | // // cout << item.pic << endl; |
| | | // i++; |
| | | // } |
| | | |
| | | // delete queue; |
| | | // } |
| | | |
| | | |
| | | int main () { |
| | | testString(); |
| | | // testArr(12); |
| | | |
| | | |
| | | mm_destroy(); |