Skip to content

Commit

Permalink
Add missing inline annotations on critical path functions.
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholassm committed Apr 6, 2024
1 parent 26a4f3b commit 5302e0f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/consumer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,15 @@ impl ConsumerBarrier {
/// Note, to establish proper happens-before relationships (and thus proper synchronization),
/// the caller must issue a [`std::sync::atomic::fence`] with
/// [`Ordering::Acquire`](std::sync::atomic::Ordering::Acquire).
#[inline]
pub(crate) fn get(&self) -> Sequence {
self.get_after(0)
}
}

impl Barrier for ConsumerBarrier {
/// Gets the available `Sequence` of the slowest consumer.
#[inline]
fn get_after(&self, _lower_bound: Sequence) -> Sequence {
self.cursors.iter().fold(i64::MAX, |min_sequence, cursor| {
let sequence = cursor.relaxed_value();
Expand Down
2 changes: 2 additions & 0 deletions src/producer/single.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,12 +158,14 @@ impl SingleProducerBarrier {

impl Barrier for SingleProducerBarrier {
/// Gets the `Sequence` of the last published event.
#[inline]
fn get_after(&self, _lower_bound: Sequence) -> Sequence {
self.cursor.relaxed_value()
}
}

impl ProducerBarrier for SingleProducerBarrier {
#[inline]
fn next(&self) -> Sequence {
self.cursor.next()
}
Expand Down

0 comments on commit 5302e0f

Please sign in to comment.