Skip to content

[C#] Remove WaitableSet and its global. Tidy <T> in codegen#1552

Open
yowl wants to merge 2 commits intobytecodealliance:mainfrom
yowl:csharp-async-tidy
Open

[C#] Remove WaitableSet and its global. Tidy <T> in codegen#1552
yowl wants to merge 2 commits intobytecodealliance:mainfrom
yowl:csharp-async-tidy

Conversation

@yowl
Copy link
Collaborator

@yowl yowl commented Mar 1, 2026

This PR removes the disposable WaitableSet class and the global, replacing it with ContextSet/ContextGet

Closes #1550

@yowl yowl requested a review from dicej March 1, 2026 12:22
Copy link
Collaborator

@dicej dicej left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM overall; just a few (optional) comments inline.

}

public static Task<T> TaskFromStatus<T>(uint status, Func<T> liftFunc)
public static unsafe Task<T> TaskFromStatus<T>(uint status, Func<T> liftFunc)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What makes this function unsafe to call? Could it be documented?

{
Console.WriteLine("FutureReader Read Blocked creating WaitableSet");
AsyncSupport.WaitableSet = AsyncSupport.WaitableSetNew();
contextTaskPtr = (ContextTask *)Marshal.AllocHGlobal(Marshal.SizeOf<ContextTask>());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These same three lines appear in several places; might want to consider adding a helper function which encapsulates them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[C#] Remove WaitableSet and use context(set/get) instead.

2 participants