Allow use of SequenceBound from multiple threads
In Cast code, we often use a SequenceBound instance to handle calls from multiple sequences and forward them to a single sequence for execution (for example for methods that need to run on an IO thread, or simply to avoid thread-safety issues by running all business logic in a single sequence). A typical usage looks like: * A wrapper class exposes some API that is called in several places in our codebase, from multiple sequences. * The implementation of the wrapper class forwards the API calls to a SequenceBound<T> instance (using Post()) that implements the actual logic. * The wrapper class creates the SequenceBound<T> in its constructor, and deletes it in its destructor. Since we have to ensure that callers do not call into the wrapper after it is destroyed anyway, this usage of SequenceBound is safe. Change-Id: I40d67cd56e34a938492a8c528ec87bc25332fd52 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2639652Reviewed-by:Daniel Cheng <dcheng@chromium.org> Reviewed-by:
Wez <wez@chromium.org> Reviewed-by:
Gabriel Charette <gab@chromium.org> Commit-Queue: Kenneth MacKay <kmackay@chromium.org> Cr-Commit-Position: refs/heads/master@{#845951}
Showing
Please register or sign in to comment