MCPcopy Create free account
hub / github.com/catboost/catboost / ExecServerThread

Method ExecServerThread

library/cpp/neh/netliba_udp_http.cpp:716–757  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

714 }
715
716 static void* ExecServerThread(void* param) {
717 TUdpHttp* pThis = (TUdpHttp*)param;
718 if (pThis->GetPhysicalCpu() >= 0) {
719 BindToSocket(pThis->GetPhysicalCpu());
720 }
721 SetHighestThreadPriority();
722
723 TIntrusivePtr<NNetlibaSocket::ISocket> socket = NNetlibaSocket::CreateSocket();
724 socket->Open(pThis->Port_);
725 if (socket->IsValid()) {
726 pThis->Port_ = socket->GetPort();
727 pThis->Host_ = CreateUdpHost(socket);
728 } else {
729 pThis->Host_ = nullptr;
730 }
731
732 pThis->HasStarted_.Signal();
733 if (!pThis->Host_)
734 return nullptr;
735
736 NHPTimer::GetTime(&pThis->PingsSendT_);
737 while (AtomicGet(pThis->KeepRunning_) && !PanicAttack) {
738 if (HeartbeatTimeout.load(std::memory_order_acquire) > 0) {
739 NHPTimer::STime chk = LastHeartbeat.load(std::memory_order_acquire);
740 if (NHPTimer::GetTimePassed(&chk) > HeartbeatTimeout.load(std::memory_order_acquire)) {
741 StopAllNetLibaThreads();
742#ifndef _win_
743 killpg(0, SIGKILL);
744#endif
745 abort();
746 break;
747 }
748 }
749 pThis->Step();
750 pThis->Wait();
751 }
752 if (!pThis->AbortTransactions_ && !PanicAttack) {
753 pThis->FinishOutstandingTransactions();
754 }
755 pThis->Host_ = nullptr;
756 return nullptr;
757 }
758
759 int GetPhysicalCpu() const noexcept {
760 return PhysicalCpu_;

Callers

nothing calls this directly

Calls 15

SetHighestThreadPriorityFunction · 0.85
GetPhysicalCpuMethod · 0.80
CreateSocketFunction · 0.70
StopAllNetLibaThreadsFunction · 0.70
BindToSocketFunction · 0.50
CreateUdpHostFunction · 0.50
AtomicGetFunction · 0.50
OpenMethod · 0.45
IsValidMethod · 0.45
GetPortMethod · 0.45
SignalMethod · 0.45
loadMethod · 0.45

Tested by

no test coverage detected