12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- #include <QCoreApplication>
- #include "modulecomm.h"
- #include <thread>
- void threadsend(void * pa)
- {
- while(1)
- {
- char str[1000];
- iv::modulecomm::ModuleSendMsg(pa,str,30);
- std::this_thread::sleep_for(std::chrono::milliseconds(100));
- }
- }
- void ListenPointCloud(const char * strdata,const unsigned int nSize,const unsigned int index,const QDateTime * dt,const char * strmemname)
- {
- qDebug("%lld recv %s ",QDateTime::currentMSecsSinceEpoch(),strmemname);
- }
- int main(int argc, char *argv[])
- {
- QCoreApplication a(argc, argv);
- void * pa1,*pa2,*pa3,*pa4,*pa5;
- void * pb1,*pb2,*pb3,*pb4,*pb5;
- pa1 = iv::modulecomm::RegisterSend("a1",100,1);
- pa2 = iv::modulecomm::RegisterSend("a2",1000,1);
- pa3 = iv::modulecomm::RegisterSend("a3",10000,1);
- pa4 = iv::modulecomm::RegisterSend("a4",100000,1);
- pa5 = iv::modulecomm::RegisterSend("a6",1000000,1);
- pb1 = iv::modulecomm::RegisterRecv("b1",ListenPointCloud);
- pb2 = iv::modulecomm::RegisterRecv("b2",ListenPointCloud);
- pb3 = iv::modulecomm::RegisterRecv("b3",ListenPointCloud);
- pb4 = iv::modulecomm::RegisterRecv("b4",ListenPointCloud);
- pb5 = iv::modulecomm::RegisterRecv("b6",ListenPointCloud);
- std::thread * pthread1 = new std::thread(threadsend,pa1);
- std::thread * pthread2 = new std::thread(threadsend,pa2);
- std::thread * pthread3 = new std::thread(threadsend,pa3);
- std::thread * pthread4 = new std::thread(threadsend,pa4);
- std::thread * pthread5 = new std::thread(threadsend,pa5);
- return a.exec();
- }
|