Skip to content

Commit

Permalink
Added note about synchronization context bringing the execution back …
Browse files Browse the repository at this point in the history
…to the main thread.
  • Loading branch information
vchelaru committed Nov 23, 2023
1 parent 1edb38c commit db029d6
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,18 @@ private static async void DoLoop()
foreach (var message in toastMessages.GetConsumingEnumerable(CancellationToken.None))
{
Toast toast = null;


// November 23, 2023
// Note: Calling await
// in this method results
// in the SynchronizationContext
// resuming the method on the main
// thread. Not sure if this is desirable
// or not. For now I'll leave it as-is since
// all seems to work, but if we want to keep this
// on a separate thread, then we need to do this:
// 'Task. Delay().configureawait(false)`

// This must be done on the primary thread in case it loads
// the PNG for the first time:
await Instructions.InstructionManager.DoOnMainThreadAsync(() =>
Expand Down

0 comments on commit db029d6

Please sign in to comment.