Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Reduce stack consumption if unable to switch to apartment_context#1276

Merged
kennykerr merged 1 commit intomicrosoft:mastermicrosoft/cppwinrt:masterfrom
oldnewthing:remove_workaroundoldnewthing/cppwinrt:remove_workaroundCopy head branch name to clipboard
Feb 16, 2023
Merged

Reduce stack consumption if unable to switch to apartment_context#1276
kennykerr merged 1 commit intomicrosoft:mastermicrosoft/cppwinrt:masterfrom
oldnewthing:remove_workaroundoldnewthing/cppwinrt:remove_workaroundCopy head branch name to clipboard

Conversation

@oldnewthing
Copy link
Member

The old code would invoke the handle recursively. The new code returns false from await_suspend, allowing the calling coroutine to resume with no stack consumption. Use [[nodiscard]] to ensure I updated all callers, and to avoid future errors with new callers.

Also remove #ifdefs to work around code generation issues in MSVC versions less than 16.11. If you are on a version that old, you should stick with an older version of C++/WinRT.

The old code would invoke the handle recursively. The new
code returns `false` from `await_suspend`, allowing the calling
coroutine to resume with no stack consumption. Use `[[nodiscard]]`
to ensure I updated all callers, and to avoid future errors with
new callers.

Also remove `#ifdef`s to work around code generation issues in
MSVC versions less than 16.11. If you are on a version that old,
you should stick with an older version of C++/WinRT.
};

inline void resume_apartment_sync(com_ptr<IContextCallback> const& context, coroutine_handle<> handle, int32_t* failure)
[[nodiscard]] inline bool resume_apartment_sync(com_ptr<IContextCallback> const& context, coroutine_handle<> handle, int32_t* failure)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I do love nodiscard. 👍

@kennykerr kennykerr merged commit 419c33a into microsoft:master Feb 16, 2023
@oldnewthing oldnewthing deleted the remove_workaround branch February 17, 2023 19:58
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.

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.