main.cpp 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #include <QCoreApplication>
  2. #include "modulecomm.h"
  3. #include <thread>
  4. void threadsend(void * pa)
  5. {
  6. while(1)
  7. {
  8. char str[1000];
  9. iv::modulecomm::ModuleSendMsg(pa,str,30);
  10. std::this_thread::sleep_for(std::chrono::milliseconds(100));
  11. }
  12. }
  13. void ListenPointCloud(const char * strdata,const unsigned int nSize,const unsigned int index,const QDateTime * dt,const char * strmemname)
  14. {
  15. qDebug("%lld recv %s ",QDateTime::currentMSecsSinceEpoch(),strmemname);
  16. }
  17. int main(int argc, char *argv[])
  18. {
  19. QCoreApplication a(argc, argv);
  20. void * pa1,*pa2,*pa3,*pa4,*pa5;
  21. void * pb1,*pb2,*pb3,*pb4,*pb5;
  22. pa1 = iv::modulecomm::RegisterSend("a1",100,1);
  23. pa2 = iv::modulecomm::RegisterSend("a2",1000,1);
  24. pa3 = iv::modulecomm::RegisterSend("a3",10000,1);
  25. pa4 = iv::modulecomm::RegisterSend("a4",100000,1);
  26. pa5 = iv::modulecomm::RegisterSend("a6",1000000,1);
  27. pb1 = iv::modulecomm::RegisterRecv("b1",ListenPointCloud);
  28. pb2 = iv::modulecomm::RegisterRecv("b2",ListenPointCloud);
  29. pb3 = iv::modulecomm::RegisterRecv("b3",ListenPointCloud);
  30. pb4 = iv::modulecomm::RegisterRecv("b4",ListenPointCloud);
  31. pb5 = iv::modulecomm::RegisterRecv("b6",ListenPointCloud);
  32. std::thread * pthread1 = new std::thread(threadsend,pa1);
  33. std::thread * pthread2 = new std::thread(threadsend,pa2);
  34. std::thread * pthread3 = new std::thread(threadsend,pa3);
  35. std::thread * pthread4 = new std::thread(threadsend,pa4);
  36. std::thread * pthread5 = new std::thread(threadsend,pa5);
  37. return a.exec();
  38. }