Lines Matching refs:thread_idx
65 virtual bool InitThreadFuncImpl(size_t thread_idx) = 0;
66 virtual bool ThreadFuncImpl(HistogramEntry* entry, size_t thread_idx) = 0;
68 void ThreadFunc(size_t thread_idx, Thread* t) override { in ThreadFunc() argument
69 if (!InitThreadFuncImpl(thread_idx)) { in ThreadFunc()
75 const bool thread_still_ok = ThreadFuncImpl(&entry, thread_idx); in ThreadFunc()
85 bool WaitToIssue(int thread_idx) { in WaitToIssue() argument
87 const gpr_timespec next_issue_time = NextIssueTime(thread_idx); in WaitToIssue()
121 bool InitThreadFuncImpl(size_t thread_idx) override { return true; } in InitThreadFuncImpl() argument
123 bool ThreadFuncImpl(HistogramEntry* entry, size_t thread_idx) override { in ThreadFuncImpl() argument
124 if (!WaitToIssue(thread_idx)) { in ThreadFuncImpl()
127 auto* stub = channels_[thread_idx % channels_.size()].get_stub(); in ThreadFuncImpl()
132 stub->UnaryCall(&context, request_, &responses_[thread_idx]); in ThreadFuncImpl()
158 CleanupAllStreams([this](size_t thread_idx) { in ~SynchronousStreamingClient() argument
160 stream_[thread_idx]->Finish().IgnoreError(); in ~SynchronousStreamingClient()
178 void FinishStream(HistogramEntry* entry, size_t thread_idx) { in FinishStream() argument
179 Status s = stream_[thread_idx]->Finish(); in FinishStream()
183 std::lock_guard<std::mutex> l(stream_mu_[thread_idx]); in FinishStream()
184 if (!shutdown_[thread_idx].val) { in FinishStream()
186 thread_idx, s.error_message().c_str()); in FinishStream()
190 std::lock_guard<std::mutex> l(stream_mu_[thread_idx]); in FinishStream()
191 context_[thread_idx].~ClientContext(); in FinishStream()
192 new (&context_[thread_idx]) ClientContext(); in FinishStream()
214 [this](size_t thread_idx) { context_[thread_idx].TryCancel(); }); in DestroyMultithreading() argument
227 [this](size_t thread_idx) { stream_[thread_idx]->WritesDone(); }); in ~SynchronousStreamingPingPongClient() argument
231 bool InitThreadFuncImpl(size_t thread_idx) override { in InitThreadFuncImpl() argument
232 auto* stub = channels_[thread_idx % channels_.size()].get_stub(); in InitThreadFuncImpl()
233 std::lock_guard<std::mutex> l(stream_mu_[thread_idx]); in InitThreadFuncImpl()
234 if (!shutdown_[thread_idx].val) { in InitThreadFuncImpl()
235 stream_[thread_idx] = stub->StreamingCall(&context_[thread_idx]); in InitThreadFuncImpl()
239 messages_issued_[thread_idx] = 0; in InitThreadFuncImpl()
243 bool ThreadFuncImpl(HistogramEntry* entry, size_t thread_idx) override { in ThreadFuncImpl() argument
244 if (!WaitToIssue(thread_idx)) { in ThreadFuncImpl()
249 if (stream_[thread_idx]->Write(request_) && in ThreadFuncImpl()
250 stream_[thread_idx]->Read(&responses_[thread_idx])) { in ThreadFuncImpl()
254 (++messages_issued_[thread_idx] < messages_per_stream_)) { in ThreadFuncImpl()
262 stream_[thread_idx]->WritesDone(); in ThreadFuncImpl()
263 FinishStream(entry, thread_idx); in ThreadFuncImpl()
264 auto* stub = channels_[thread_idx % channels_.size()].get_stub(); in ThreadFuncImpl()
265 std::lock_guard<std::mutex> l(stream_mu_[thread_idx]); in ThreadFuncImpl()
266 if (!shutdown_[thread_idx].val) { in ThreadFuncImpl()
267 stream_[thread_idx] = stub->StreamingCall(&context_[thread_idx]); in ThreadFuncImpl()
269 stream_[thread_idx].reset(); in ThreadFuncImpl()
272 messages_issued_[thread_idx] = 0; in ThreadFuncImpl()
284 [this](size_t thread_idx) { stream_[thread_idx]->WritesDone(); }); in ~SynchronousStreamingFromClientClient() argument
290 bool InitThreadFuncImpl(size_t thread_idx) override { in InitThreadFuncImpl() argument
291 auto* stub = channels_[thread_idx % channels_.size()].get_stub(); in InitThreadFuncImpl()
292 std::lock_guard<std::mutex> l(stream_mu_[thread_idx]); in InitThreadFuncImpl()
293 if (!shutdown_[thread_idx].val) { in InitThreadFuncImpl()
294 stream_[thread_idx] = stub->StreamingFromClient(&context_[thread_idx], in InitThreadFuncImpl()
295 &responses_[thread_idx]); in InitThreadFuncImpl()
299 last_issue_[thread_idx] = UsageTimer::Now(); in InitThreadFuncImpl()
303 bool ThreadFuncImpl(HistogramEntry* entry, size_t thread_idx) override { in ThreadFuncImpl() argument
305 if (!WaitToIssue(thread_idx)) { in ThreadFuncImpl()
309 if (stream_[thread_idx]->Write(request_)) { in ThreadFuncImpl()
311 entry->set_value((now - last_issue_[thread_idx]) * 1e9); in ThreadFuncImpl()
312 last_issue_[thread_idx] = now; in ThreadFuncImpl()
315 stream_[thread_idx]->WritesDone(); in ThreadFuncImpl()
316 FinishStream(entry, thread_idx); in ThreadFuncImpl()
317 auto* stub = channels_[thread_idx % channels_.size()].get_stub(); in ThreadFuncImpl()
318 std::lock_guard<std::mutex> l(stream_mu_[thread_idx]); in ThreadFuncImpl()
319 if (!shutdown_[thread_idx].val) { in ThreadFuncImpl()
320 stream_[thread_idx] = stub->StreamingFromClient(&context_[thread_idx], in ThreadFuncImpl()
321 &responses_[thread_idx]); in ThreadFuncImpl()
323 stream_[thread_idx].reset(); in ThreadFuncImpl()
340 bool InitThreadFuncImpl(size_t thread_idx) override { in InitThreadFuncImpl() argument
341 auto* stub = channels_[thread_idx % channels_.size()].get_stub(); in InitThreadFuncImpl()
342 std::lock_guard<std::mutex> l(stream_mu_[thread_idx]); in InitThreadFuncImpl()
343 if (!shutdown_[thread_idx].val) { in InitThreadFuncImpl()
344 stream_[thread_idx] = in InitThreadFuncImpl()
345 stub->StreamingFromServer(&context_[thread_idx], request_); in InitThreadFuncImpl()
349 last_recv_[thread_idx] = UsageTimer::Now(); in InitThreadFuncImpl()
353 bool ThreadFuncImpl(HistogramEntry* entry, size_t thread_idx) override { in ThreadFuncImpl() argument
355 if (stream_[thread_idx]->Read(&responses_[thread_idx])) { in ThreadFuncImpl()
357 entry->set_value((now - last_recv_[thread_idx]) * 1e9); in ThreadFuncImpl()
358 last_recv_[thread_idx] = now; in ThreadFuncImpl()
361 FinishStream(entry, thread_idx); in ThreadFuncImpl()
362 auto* stub = channels_[thread_idx % channels_.size()].get_stub(); in ThreadFuncImpl()
363 std::lock_guard<std::mutex> l(stream_mu_[thread_idx]); in ThreadFuncImpl()
364 if (!shutdown_[thread_idx].val) { in ThreadFuncImpl()
365 stream_[thread_idx] = in ThreadFuncImpl()
366 stub->StreamingFromServer(&context_[thread_idx], request_); in ThreadFuncImpl()
368 stream_[thread_idx].reset(); in ThreadFuncImpl()
383 [this](size_t thread_idx) { stream_[thread_idx]->WritesDone(); }); in ~SynchronousStreamingBothWaysClient() argument
387 bool InitThreadFuncImpl(size_t thread_idx) override { in InitThreadFuncImpl() argument
388 auto* stub = channels_[thread_idx % channels_.size()].get_stub(); in InitThreadFuncImpl()
389 std::lock_guard<std::mutex> l(stream_mu_[thread_idx]); in InitThreadFuncImpl()
390 if (!shutdown_[thread_idx].val) { in InitThreadFuncImpl()
391 stream_[thread_idx] = stub->StreamingBothWays(&context_[thread_idx]); in InitThreadFuncImpl()
398 bool ThreadFuncImpl(HistogramEntry* entry, size_t thread_idx) override { in ThreadFuncImpl() argument