From 37491f4a5d25c506b2e4ff0f9cbbeb4053310cf7 Mon Sep 17 00:00:00 2001 From: zhangmeng <775834166@qq.com> Date: 星期三, 17 五月 2023 15:24:15 +0800 Subject: [PATCH] for test --- cmd/TST/ctest/ctest.cpp | 24 ++++++++++++++++-------- 1 files changed, 16 insertions(+), 8 deletions(-) diff --git a/cmd/TST/ctest/ctest.cpp b/cmd/TST/ctest/ctest.cpp index 73be301..b435012 100644 --- a/cmd/TST/ctest/ctest.cpp +++ b/cmd/TST/ctest/ctest.cpp @@ -50,12 +50,18 @@ void* con = createConsumer(t, c); - char ip[] = "192.168.20.108:4150"; - GoString addr = {ip, (ptrdiff_t)strlen(ip)}; // thread - thread([&con,&addr]{ - Run(con, addr); + thread([&con]{ + + // char ip[] = "192.168.20.108:4150"; + // GoString addr = {ip, (ptrdiff_t)strlen(ip)}; + // Run(con, addr); + + char lip[] = "192.168.20.108:4161"; + GoString laddr = {lip, (ptrdiff_t)strlen(lip)}; + RunLookupd(con, laddr); + }).detach(); auto start = chrono::steady_clock::now(); @@ -72,7 +78,7 @@ printf("======>> recv msg %s size %d\n", (char*)msg, count); relMessage(msg); if (count > 999000){ - printf("======>> use time %d\n", + printf("======>> use time %ld\n", chrono::duration_cast<chrono::seconds>(chrono::steady_clock::now()-start).count()); } } @@ -81,11 +87,13 @@ int main(int argc, char const *argv[]) { - thread([]{ - produce(true); + bool two = false; + + thread([two]{ + produce(two); }).detach(); - thread([]{ consume("test2", "sensor01"); }).detach(); + if (two) thread([]{ consume("test2", "sensor01"); }).detach(); consume("test", "sensor01"); -- Gitblit v1.8.0