File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -113,7 +113,7 @@ void example2(async::AsyncHttp& http)
113113// ---------------------------------------------------------------------------
114114static std::atomic<int > workersDone{0 };
115115
116- static void WorkerGetWait (async::AsyncHttp* http, std::string threadName)
116+ static void WorkerGetWait (std::shared_ptr< async::AsyncHttp> http, std::string threadName)
117117{
118118 async::HttpResponse resp = http->GetWait (" https://httpbin.org/get" ,
119119 std::chrono::seconds (15 ));
@@ -135,9 +135,10 @@ std::chrono::microseconds example3(async::AsyncHttp& http)
135135
136136 auto start = std::chrono::high_resolution_clock::now ();
137137
138+ auto httpPtr = std::shared_ptr<async::AsyncHttp>(&http, [](async::AsyncHttp*){});
138139 for (int i = 0 ; i < WORKER_THREAD_CNT ; ++i) {
139140 auto delegate = MakeDelegate (WorkerGetWait, workerThreads[i]);
140- delegate (&http , workerThreads[i].GetThreadName ());
141+ delegate (httpPtr , workerThreads[i].GetThreadName ());
141142 }
142143
143144 std::unique_lock<std::mutex> lock (cvMtx);
You can’t perform that action at this time.
0 commit comments