[seraphis] async: add async framework #9337
Open
+3,429
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a PR in my 'upstreaming seraphis_lib project', the changes here are not used anywhere yet.
Depends on:
Adds an async framework.
async::Threadpool
Adds a threadpool modeled after Sean Parent's threadpool. A reference implementation of Parent's threadpool is included under the
parent
namespace. Here is a lecture from Parent talking about concurrency.Features:
WaiterManager
handles this internally.This threadpool is used in @j-berman's async scanner.
Single-writer/multi-reader data structure
Adds a thread-safe tool for read/write access to data. You can use
writable
/readable
handles to getwrite_locks
andread_locks
.One use-case here is in responsive balance recovery. You can pass a
writable<EnoteStore>
to the balance recovery machinery, and then continuously emit enote store events along withreadable<EnoteStore>
handles to wallet code. The wallet code can acquireread_locks
on the store to update its user-facing data structures based on the events that occur.Mutex
Adds a mutex wrapper that lets you validate that the current thread owns a lock. Used in the async scanner for checking synchronization invariants.