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

Tokio locks pr #82

Merged
merged 4 commits into from
Jan 9, 2024
Merged

Commits on Jan 8, 2024

  1. feat: add wrappers for tokio Mutex and RwLock

    Adds util_types::sync::tokio::{AtomicMutex, AtomicRw} which are tokio
    counterparts of twenty_first::sync::{AtomicMutex, AtomicRw}.
    dan-da committed Jan 8, 2024
    Configuration menu
    Copy the full SHA
    d5b1680 View commit details
    Browse the repository at this point in the history
  2. feat: add async closure methods to Atomic wrappers

    Adds `with_async()` and `with_mut_async()` to AtomicRw and AtomicMutex
    dan-da committed Jan 8, 2024
    Configuration menu
    Copy the full SHA
    a5eebb9 View commit details
    Browse the repository at this point in the history
  3. refactor: rename sync locking methods

    Renames locking methods in crate::sync to include the word "lock".
    
    The word "with" is a bit vague, and when reading code that is using
    the locks, it is helpful to clearly see where locks occur, and which
    type.
    
    The renames are:
     with()      --> lock()
     with_mut()  --> lock_mut()
     guard()     --> lock_guard()
     guard_mut() --> lock_guard_mut()
    
    These match the naming in twenty_first::sync::*
    dan-da committed Jan 8, 2024
    Configuration menu
    Copy the full SHA
    6c25b06 View commit details
    Browse the repository at this point in the history

Commits on Jan 9, 2024

  1. feat: lock event callbacks

    Atomic lock types in util_types::sync::tokio now accept
    an optional name and lock-event callback fn.
    
    This enables the app to be notified of lock events and take appropriate
    action, such as logging/tracing.
    
    These features are optional and the API is backwards compatible
    with code that does not need lock-event notifications.
    dan-da committed Jan 9, 2024
    Configuration menu
    Copy the full SHA
    e8f9e90 View commit details
    Browse the repository at this point in the history