MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / Run

Method Run

tensorflow/core/kernels/task_runner.h:34–48  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32 : func_(f), thread_pool_(tp), num_tasks_(n) {}
33
34 void Run() {
35 if (num_tasks_ <= 0) return;
36 BlockingCounter bc(num_tasks_ - 1);
37
38 // Sending (num_tasks - 1) tasks to threadpool for scheduling
39 for (int32 i = 0; i < num_tasks_ - 1; ++i) {
40 thread_pool_->Schedule([this, &bc, i]() {
41 func_(i, num_tasks_);
42 bc.DecrementCount();
43 });
44 }
45 // Run the last task in current thread.
46 func_(num_tasks_ - 1, num_tasks_);
47 bc.Wait();
48 }
49
50 private:
51 std::function<void(int32 task_id, int32 num_tasks)> func_;

Callers

nothing calls this directly

Calls 3

ScheduleMethod · 0.45
DecrementCountMethod · 0.45
WaitMethod · 0.45

Tested by

no test coverage detected