Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/AppInstallerCLITests/Yaml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ TEST_CASE("YamlMergeSequenceNode_CaseInsensitive", "[YAML]")
auto luffy = std::find_if(
document["StrawHats"].Sequence().begin(),
document["StrawHats"].Sequence().end(),
[](auto const& n) { return n["Name"].as<std::string>() == "Monkey D Luffy"; });
[](Node const& n) { return n["Name"].as<std::string>() == "Monkey D Luffy"; });
REQUIRE(luffy != document["StrawHats"].Sequence().end());

// From original node
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#pragma once
#include <exception>
#include <AppInstallerLogging.h>
#include <AppInstallerStrings.h>

namespace winrt::Microsoft::Management::Configuration::implementation
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@
<ItemDefinitionGroup Condition="'$(Configuration)'=='Debug'">
<ClCompile>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ProgramDataBaseFileName>$(OutDir)$(TargetName)Debug.pdb</ProgramDataBaseFileName>
<RuntimeTypeInfo Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">false</RuntimeTypeInfo>
<RuntimeTypeInfo Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</RuntimeTypeInfo>
<RuntimeTypeInfo Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</RuntimeTypeInfo>
Expand Down Expand Up @@ -325,4 +324,3 @@
<Error Condition="!Exists('$(SolutionDir)\packages\Microsoft.Windows.ImplementationLibrary.1.0.250325.1\build\native\Microsoft.Windows.ImplementationLibrary.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\packages\Microsoft.Windows.ImplementationLibrary.1.0.250325.1\build\native\Microsoft.Windows.ImplementationLibrary.targets'))" />
</Target>
</Project>

56 changes: 28 additions & 28 deletions src/Microsoft.Management.Configuration/ShutdownSynchronization.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,34 @@ namespace winrt::Microsoft::Management::Configuration::implementation
std::unique_ptr<AppInstaller::WinRT::AsyncCancellation> m_cancellation;
};

struct ShutdownSynchronization
{
using CancellableWeakPtr = std::weak_ptr<AppInstaller::WinRT::details::AsyncCancellationTypeErasure>;

ShutdownSynchronization() = default;

static ShutdownSynchronization& Instance();

// Signals that new work should be blocked.
void BlockNewWork();

// Call to register the begin and end of work.
void RegisterWorkBegin(CancellableWeakPtr&& ptr);
void RegisterWorkEnd(CancellableWeakPtr&& ptr);

// Cancels all currently registered work.
void CancelAllWork();

// Waits for outstanding work to be completed.
void Wait();

private:
std::atomic_bool m_disabled{ false };
std::mutex m_workLock;
std::set<CancellableWeakPtr, std::owner_less<CancellableWeakPtr>> m_work;
wil::slim_event_manual_reset m_noActiveWork{ true };
};

// An AsyncProgress that registers with ShutdownSynchronization.
template <typename ResultT, typename ProgressT>
struct ShutdownAwareAsyncProgress
Expand Down Expand Up @@ -142,32 +170,4 @@ namespace winrt::Microsoft::Management::Configuration::implementation
std::unique_ptr<ShutdownAwareAsyncCancellationPromise> m_defaultPromise;
std::unique_ptr<AppInstaller::WinRT::AsyncProgress<ResultT, ProgressT>> m_progress;
};

struct ShutdownSynchronization
{
using CancellableWeakPtr = std::weak_ptr<AppInstaller::WinRT::details::AsyncCancellationTypeErasure>;

ShutdownSynchronization() = default;

static ShutdownSynchronization& Instance();

// Signals that new work should be blocked.
void BlockNewWork();

// Call to register the begin and end of work.
void RegisterWorkBegin(CancellableWeakPtr&& ptr);
void RegisterWorkEnd(CancellableWeakPtr&& ptr);

// Cancels all currently registered work.
void CancelAllWork();

// Waits for outstanding work to be completed.
void Wait();

private:
std::atomic_bool m_disabled{ false };
std::mutex m_workLock;
std::set<CancellableWeakPtr, std::owner_less<CancellableWeakPtr>> m_work;
wil::slim_event_manual_reset m_noActiveWork{ true };
};
}
3 changes: 2 additions & 1 deletion src/Microsoft.Management.Configuration/pch.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
#include <winrt/Windows.Storage.Streams.h>

#pragma warning( push )
#pragma warning ( disable : 4467 6388)
#pragma warning ( disable : 4324 4467 6388 )
// 4324 Structure was padded due to alignment specifier
// 4467 Allow use of uuid attribute for com object creation.
// 6388 Allow CreateInstance.
#include <wil/cppwinrt_wrl.h>
Expand Down
2 changes: 1 addition & 1 deletion src/SfsClient/SfsClient.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Release'" Label="Configuration">
<PropertyGroup Condition="'$(Configuration)'=='Release' or '$(Configuration)'=='ReleaseStatic'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<SpectreMitigation>Spectre</SpectreMitigation>
Expand Down