From a884637d0376d469ee307ebe1d117ae908a4c340 Mon Sep 17 00:00:00 2001 From: zhangmeng <775834166@qq.com> Date: 星期一, 13 十二月 2021 13:01:58 +0800 Subject: [PATCH] bug fixed for asyn rep-req timeout --- main.cpp | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-) diff --git a/main.cpp b/main.cpp index d279be2..ecbaa5a 100644 --- a/main.cpp +++ b/main.cpp @@ -6,6 +6,7 @@ #include <vector> #include <thread> #include <chrono> +#include <atomic> using namespace std; #include "src/bn_api.h" @@ -15,10 +16,11 @@ thread([]{ string base_cont("test_req_rep=="); + atomic<uint64_t> index{0}; vector<thread> v_t; - for (int i = 0; i < 200; i++){ - v_t.emplace_back([&base_cont, i]{ - int64_t index = 0; + for (int i = 0; i < 621; i++){ + v_t.emplace_back([&base_cont, i, &index]{ + while (true) { // printf("start request\n"); // auto s = chrono::steady_clock::now(); @@ -31,7 +33,6 @@ }); } - int64_t index = 0; while (true) { // printf("start request\n"); // auto s = chrono::steady_clock::now(); -- Gitblit v1.8.0