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

Refactor: Implement Custom Async Mutex Using Oneshot Channel #1208

Closed
wants to merge 1 commit into from

Commits on Jul 30, 2024

  1. Refactor: Implement custom async Mutex using Oneshot channel

    This commit introduces a custom implementation of an asynchronous Mutex
    using the `AsyncRuntime::Oneshot` functions, tailored specifically for
    Openraft's limited use of asynchronous locks. This custom mutex replaces
    the previously used Tokio mutex.
    
    - **Refactor of `RaftInner::tx_shutdown`:** The `tx_shutdown` member of
      `RaftInner` has been changed to use a standard (synchronous) Mutex
      instead of an asynchronous one. This change is made because
      `tx_shutdown` does not span across `.await` points, making the
      asynchronous capabilities unnecessary.
    
    - **OneshotSender `Drop` Implementation:** It is now documented that the
      `OneshotSender` should implement the `Drop` trait to ensure that when
      a sender is dropped, the receiver is notified and yields an error.
      This behavior is crucial for maintaining robust error handling in
      asynchronous communication patterns.
    drmingdrmer committed Jul 30, 2024
    Configuration menu
    Copy the full SHA
    bc4b4e5 View commit details
    Browse the repository at this point in the history