xmtp_mls_core/
task_channels.rs1use std::sync::Arc;
2
3#[derive(Clone)]
4pub struct TaskWorkerChannels {
5 pub notification_request: Arc<tokio::sync::Mutex<()>>,
7 notification_revision: Arc<std::sync::atomic::AtomicUsize>,
8}
9
10impl Default for TaskWorkerChannels {
11 fn default() -> Self {
12 Self::new()
13 }
14}
15
16impl TaskWorkerChannels {
17 pub fn new() -> Self {
18 Self {
19 notification_request: Default::default(),
20 notification_revision: Default::default(),
21 }
22 }
23
24 pub fn mark_notification_changed(&self) {
26 use std::sync::atomic::Ordering;
27 self.notification_revision.fetch_add(1, Ordering::AcqRel);
28 }
29
30 pub fn notification_revision(&self) -> usize {
33 self.notification_revision
34 .load(std::sync::atomic::Ordering::Acquire)
35 }
36}