Page 1 of 1

So prüfen Sie, ob ein Threadpool vorhanden ist, bevor Sie CreateThreadpoolTimer aufrufen

Posted: 05 Jan 2025, 07:59
by Guest
Ich frage mich, wie ich überprüfen kann, ob ein Threadpool vorhanden ist, bevor ich CreateThreadpoolTimer aufrufe?
Dies ist der Stacktrace, den ich analysiere:

Code: Select all

ntdll!TppRaiseInvalidParameter+0x48 [minkernel\threadpool\ntdll\tp.c @ 191]
ntdll!TpAllocTimer+0xa616b [minkernel\threadpool\ntdll\timer.c @ 1468]
kernel32!CreateThreadpoolTimerStub+0x1b [clientcore\base\win32\client\stub.c @ 5488]
fabricruntime!Common::Timer::GetTimerCallerHoldingLock+0x6a [C:\__w\1\s\src\prod\src\Common\Timer.cpp @ 194]
fabricruntime!Common::Timer::SetTimer+0x5e [C:\__w\1\s\src\prod\src\Common\Timer.cpp @ 79]
fabricruntime!Common::Timer::Change+0x55 [C:\__w\1\s\src\prod\src\Common\Timer.cpp @ 56]
fabricruntime!Common::TimedAsyncOperation::InternalStartTimer+0x197 [C:\__w\1\s\src\prod\src\Common\TimedAsyncOperation.cpp @ 58]
fabricruntime!Common::AsyncOperation::Start+0xc0 [C:\__w\1\s\src\prod\src\Common\AsyncOperation.cpp @ 77]
fabricruntime!Transport::RequestReply::RequestReplyAsyncOperation::OnStart+0x1a6 [C:\__w\1\s\src\prod\src\Transport\requestreply.cpp @ 78]
fabricruntime!Common::AsyncOperation::Start+0xc0 [C:\__w\1\s\src\prod\src\Common\AsyncOperation.cpp @ 77]
fabricruntime!Common::AsyncOperation::CreateAndStart_Transport::RequestReply::RequestReplyAsyncOperation,Transport::RequestReply &,std::unique_ptr_Transport::Message,std::default_delete_Transport::Message_ _,std::shared_ptr_Transport::ISendTarget_ const &,enum Transpor+0xc7 [C:\__w\1\s\src\prod\src\Common\AsyncOperation.h @ 188]
fabricruntime!Transport::RequestReply::BeginRequest+0x3e [C:\__w\1\s\src\prod\src\Transport\requestreply.cpp @ 253]
fabricruntime!Transport::TcpClient_Transport::IpcDemuxer,17_::BeginRequest+0x74 [C:\__w\1\s\src\prod\src\Transport\TcpClient.h @ 110]
fabricruntime!Hosting2::ApplicationHost::UnregisterFabricRuntimeAsyncOperation::UnregisterFabricRuntime+0x1ab [C:\__w\1\s\src\prod\src\Hosting2\ApplicationHost.cpp @ 2256]
fabricruntime!Common::AsyncOperation::Start+0xc0 [C:\__w\1\s\src\prod\src\Common\AsyncOperation.cpp @ 77]
fabricruntime!Hosting2::ApplicationHost::UnregisterRuntimeAsync+0x102 [C:\__w\1\s\src\prod\src\Hosting2\ApplicationHost.cpp @ 3313]
fabricruntime!Hosting2::ComFabricRuntime::~ComFabricRuntime+0x5a [C:\__w\1\s\src\prod\src\Hosting2\ComFabricRuntime.cpp @ 498]
fabricruntime!Hosting2::ComFabricRuntime::`scalar deleting destructor'+0x14
fabricruntime!Common::ComUnknownBase::BaseRelease+0x3e [C:\__w\1\s\src\prod\src\Common\ComUnknownBase.cpp @ 69]
Der Fehler zeigt an, dass CreateThreadpoolTimer aufgerufen wird, aber wir befinden uns im abrupten Beenden und der Threadpool existiert nicht mehr. Referenz: Dies ist ein Problem beim Herunterfahren des Programms, es bombardiert den Threadpool nicht mehr existiert.

Ich frage mich also, wie ich diesen Fehler überprüfen kann, indem ich teste, ob Threadpool existiert oder nicht, bevor ich CreateThreadpoolTimer aufrufe ODER wie ich es richtig mache Behandeln Sie den Fehler.
Dokumentation:
https://learn.microsoft.com/en-us/windo ... dpooltimer