Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add fallback implementation for waitable atomics #6293

Merged
merged 1 commit into from Aug 2, 2019

Conversation

Nekotekina
Copy link
Member

May improve perf on OSX/BSD

{
// Initialize node from a dummy container (there is no separate node constructor)
std::multimap<const void*, waiter> dummy;
return dummy.extract(dummy.emplace(nullptr, &s_tls_waiter));
Copy link
Contributor

Choose a reason for hiding this comment

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

May be a long shot, but won't constructing via an initializer list work? Or would that be relying on an implementation detail?

Copy link
Member Author

Choose a reason for hiding this comment

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

There is no usable autonomous constructors for nodes in standard (except default and move).

{
auto& wmap = get_fallback_map(data);

std::lock_guard lock(wmap.mutex);
Copy link
Contributor

Choose a reason for hiding this comment

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

Is shared_mutex (essentially a read/write lock) available on this platform? It'd allow concurrent access on wmap.list for reading.

Copy link
Member Author

Choose a reason for hiding this comment

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

It may be available on all C++17 compatible platforms, but it's not usable with std::condition_variable, and the map is modified upon notification.

Copy link
Contributor

Choose a reason for hiding this comment

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

std::condition_variable_any may meet the requirements for that.

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh, you can see that its implementation typically has a pair of std::mutex and std::condition_variable (which are only optimized to be interoperable).

@Nekotekina Nekotekina merged commit 5bd17a4 into RPCS3:master Aug 2, 2019
@RPCS3 RPCS3 deleted a comment from welch1112 Mar 3, 2020
@RPCS3 RPCS3 locked as off-topic and limited conversation to collaborators Mar 3, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants