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

Improve write_database_queue::wait description and add [[nodiscard]] #4522

Merged
merged 1 commit into from
Mar 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions nano/node/write_database_queue.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,16 @@ class write_guard final
bool owns{ true };
};

/**
* Allocates database write access in a fair maner rather than directly waiting for mutex aquisition
* Users should wait() for access to database write transaction and hold the write_guard until complete
*/
class write_database_queue final
{
public:
write_database_queue (bool use_noops_a);
/** Blocks until we are at the head of the queue */
write_guard wait (nano::writer writer);
/** Blocks until we are at the head of the queue and blocks other waiters until write_guard goes out of scope */
[[nodiscard ("write_guard blocks other waiters")]] write_guard wait (nano::writer writer);

/** Returns true if this writer is now at the front of the queue */
bool process (nano::writer writer);
Expand Down
Loading