| | |
| | | ROOT=.. |
| | | LDLIBS+=-Wl,-rpath=$(ROOT)/lib:$(ROOT)/build/lib |
| | | # 开源工具包路径 |
| | | LDDIR += -L$(ROOT)/lib -L$(ROOT)/build/lib |
| | | LDDIR += -L$(ROOT)/build/lib |
| | | # 开源工具包 |
| | | LDLIBS += -lshm_queue -lusgcommon -lpthread |
| | | |
| | |
| | | include $(ROOT)/Make.defines.$(PLATFORM) |
| | | |
| | | |
| | | PROGS = test |
| | | PROGS = test_queue |
| | | |
| | | build: $(PROGS) |
| | | |
| | |
| | | #include "usg_common.h" |
| | | #include "usg_typedef.h" |
| | | #include "shm_queue.h" |
| | | #include "shm_queue_wrapper.h" |
| | | #include "shm_allocator.h" |
| | | #include <sstream> |
| | | //#include "queue_factory.h" |
| | |
| | | std::ostringstream outstr; |
| | | int key = 2; |
| | | |
| | | shmstring item; |
| | | std::string item; |
| | | |
| | | size_t qsize = 16; |
| | | //LockFreeQueue<struct Item> *queue = QueueFactory::createQueue<struct Item> (key, qsize); |
| | | SHMQueue<shmstring> *queue = new SHMQueue<shmstring>(key, 16); |
| | | SHMQueue<std::string> *queue = new SHMQueue<std::string>(key, 16); |
| | | // LockFreeQueue<struct Item> queue(16); |
| | | for(i = 0; i < qsize; i++) { |
| | | outstr.seekp(0); |
| | |
| | | // cout << "i=" << i << ":" << item << endl; |
| | | // } |
| | | |
| | | |
| | | shm_remove_queue(key); |
| | | |
| | | struct timespec timeout = {1, 0}; |
| | | |
| | |
| | | int main () { |
| | | mm_init(512); |
| | | // testArr(12); |
| | | testStruct(); |
| | | testString(); |
| | | |
| | | mm_destroy(); |
| | | return 0; |