Skip to content

v0.0.2

Compare
Choose a tag to compare
@Delsin-Yu Delsin-Yu released this 29 Jan 08:50
· 30 commits to main since this release

Fix an issue where SwitchToMainThread not working if the first API call is SwitchToThreadPool.

// Assuming this is the only script inside a Godot project.
var mainThreadId = System.Environment.CurrentManagedThreadId;
Assertions.AssertThat(Thread.CurrentThread.IsThreadPoolThread).IsFalse();

await GDTask.SwitchToThreadPool();

Assertions.AssertThat(System.Environment.CurrentManagedThreadId).IsNotEqual(mainThreadId);
Assertions.AssertThat(Thread.CurrentThread.IsThreadPoolThread).IsTrue();

await GDTask.SwitchToMainThread();

// This doesn't pass the test in v0.0.1.
Assertions.AssertThat(System.Environment.CurrentManagedThreadId).IsEqual(mainThreadId);
Assertions.AssertThat(Thread.CurrentThread.IsThreadPoolThread).IsFalse();

Full Changelog: v0.0.1...v0.0.2