Skip to content

Commit

Permalink
[Awake]PROMETHEAN_09082024 - tray icon fixes (microsoft#34717)
Browse files Browse the repository at this point in the history
* Update with bug fixes for tray icon and support for parent process

* Process information enum

* Update the docs

* Fix spelling

* Make sure that PID is used in PT config flow

* Logic for checks based on microsoft#34148

* Update with link to PR

* Small cleanup

* Proper task segmentation in a function

* Cleanup the code

* Fix synchronization context issue

* Update planning doc

* Test disabling caching to see if that manages to pass CI
  • Loading branch information
dend authored Sep 26, 2024
1 parent 3cdb30c commit 49a8282
Show file tree
Hide file tree
Showing 6 changed files with 259 additions and 230 deletions.
2 changes: 1 addition & 1 deletion .pipelines/v2/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ parameters:
- name: enableMsBuildCaching
type: boolean
displayName: "Enable MSBuild Caching"
default: true
default: false
- name: runTests
type: boolean
displayName: "Run Tests"
Expand Down
23 changes: 16 additions & 7 deletions doc/planning/awake.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,22 @@ The build ID can be found in `Core\Constants.cs` in the `BuildId` variable - it

The build ID moniker is made up of two components - a reference to a [Halo](https://en.wikipedia.org/wiki/Halo_(franchise)) character, and the date when the work on the specific build started in the format of `MMDDYYYY`.

| Build ID | Build Date |
|:-------------------------------------------------------------------|:----------------|
| [`VISEGRADRELAY_08152024`](#VISEGRADRELAY_08152024-august-15-2024) | August 15, 2024 |
| [`DAISY023_04102024`](#DAISY023_04102024-april-10-2024) | April 10, 2024 |
| [`ATRIOX_04132023`](#ATRIOX_04132023-april-13-2023) | April 13, 2023 |
| [`LIBRARIAN_03202022`](#librarian_03202022-march-20-2022) | March 20, 2022 |
| `ARBITER_01312022` | January 31, 2022 |
| Build ID | Build Date |
|:-------------------------------------------------------------------|:------------------|
| [`PROMETHEAN_09082024`](#PROMETHEAN_09082024-september-8-2024) | September 8, 2024 |
| [`VISEGRADRELAY_08152024`](#VISEGRADRELAY_08152024-august-15-2024) | August 15, 2024 |
| [`DAISY023_04102024`](#DAISY023_04102024-april-10-2024) | April 10, 2024 |
| [`ATRIOX_04132023`](#ATRIOX_04132023-april-13-2023) | April 13, 2023 |
| [`LIBRARIAN_03202022`](#librarian_03202022-march-20-2022) | March 20, 2022 |
| `ARBITER_01312022` | January 31, 2022 |

### `PROMETHEAN_09082024` (September 8, 2024)

>[!NOTE]
>See pull request: [Awake - `PROMETHEAN_09082024`](https://github.com/microsoft/PowerToys/pull/34717)
- Updating the initialization logic to make sure that settings are respected for proper group policy and single-instance detection.
- [#34148] Fixed a bug from the previous release that incorrectly synchronized threads for shell icon creation and initialized parent PID when it was not parented.

### `VISEGRADRELAY_08152024` (August 15, 2024)

Expand Down
2 changes: 1 addition & 1 deletion src/modules/awake/Awake/Core/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ internal static class Constants
// Format of the build ID is: CODENAME_MMDDYYYY, where MMDDYYYY
// is representative of the date when the last change was made before
// the pull request is issued.
internal const string BuildId = "VISEGRADRELAY_08152024";
internal const string BuildId = "PROMETHEAN_09082024";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,16 @@
using System.Collections.Generic;
using System.Threading;

namespace Awake.Core.Models
namespace Awake.Core.Threading
{
internal sealed class SingleThreadSynchronizationContext : SynchronizationContext
{
private readonly Queue<Tuple<SendOrPostCallback, object>> queue =
new();
private readonly Queue<Tuple<SendOrPostCallback, object?>?> queue = new();

#pragma warning disable CS8765 // Nullability of type of parameter doesn't match overridden member (possibly because of nullability attributes).
public override void Post(SendOrPostCallback d, object state)
#pragma warning restore CS8765 // Nullability of type of parameter doesn't match overridden member (possibly because of nullability attributes).
public override void Post(SendOrPostCallback d, object? state)
{
ArgumentNullException.ThrowIfNull(d);

lock (queue)
{
queue.Enqueue(Tuple.Create(d, state));
Expand All @@ -28,7 +27,7 @@ public void BeginMessageLoop()
{
while (true)
{
Tuple<SendOrPostCallback, object> work;
Tuple<SendOrPostCallback, object?>? work;
lock (queue)
{
while (queue.Count == 0)
Expand All @@ -44,17 +43,22 @@ public void BeginMessageLoop()
break;
}

work.Item1(work.Item2);
try
{
work.Item1(work.Item2);
}
catch (Exception e)
{
Console.WriteLine("Error during execution: " + e.Message);
}
}
}

public void EndMessageLoop()
{
lock (queue)
{
#pragma warning disable CS8625 // Cannot convert null literal to non-nullable reference type.
queue.Enqueue(null); // Signal the end of the message loop
#pragma warning restore CS8625 // Cannot convert null literal to non-nullable reference type.
Monitor.Pulse(queue);
}
}
Expand Down
Loading

0 comments on commit 49a8282

Please sign in to comment.