Skip to content

Commit 438b642

Browse files
authored
Add thread globals for downloader thread (#6141)
1 parent d40a4ac commit 438b642

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/AppInstallerCommonCore/Downloader.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include "Public/winget/Filesystem.h"
1515
#include "DODownloader.h"
1616
#include "HttpStream/HttpRandomAccessStream.h"
17+
#include "Public/winget/ThreadGlobals.h"
1718

1819
using namespace AppInstaller::Runtime;
1920
using namespace AppInstaller::Settings;
@@ -547,8 +548,10 @@ namespace AppInstaller::Utility
547548

548549
HRESULT hr = S_OK;
549550

550-
std::thread aesThread([&]()
551+
ThreadLocalStorage::ThreadGlobals* globals = ThreadLocalStorage::ThreadGlobals::GetForCurrentThread();
552+
std::thread aesThread([&, globals]()
551553
{
554+
auto globalsCleanup = globals ? globals->SetForCurrentThread() : nullptr;
552555
try
553556
{
554557
hr = LOG_IF_FAILED(CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED));

0 commit comments

Comments
 (0)