MCPcopy Create free account
hub / github.com/Tiiny-AI/PowerInfer / operator()

Method operator()

examples/server/httplib.h:622–640  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

620 explicit worker(ThreadPool &pool) : pool_(pool) {}
621
622 void operator()() {
623 for (;;) {
624 std::function<void()> fn;
625 {
626 std::unique_lock<std::mutex> lock(pool_.mutex_);
627
628 pool_.cond_.wait(
629 lock, [&] { return !pool_.jobs_.empty() || pool_.shutdown_; });
630
631 if (pool_.shutdown_ && pool_.jobs_.empty()) { break; }
632
633 fn = std::move(pool_.jobs_.front());
634 pool_.jobs_.pop_front();
635 }
636
637 assert(true == static_cast<bool>(fn));
638 fn();
639 }
640 }
641
642 ThreadPool &pool_;
643 };

Callers

nothing calls this directly

Calls 4

fnFunction · 0.50
waitMethod · 0.45
emptyMethod · 0.45
pop_frontMethod · 0.45

Tested by

no test coverage detected