Skip to content

Commit 4c19fbd

Browse files
committed
subscribe
1 parent 41776f3 commit 4c19fbd

File tree

1 file changed

+10
-1
lines changed
  • crates/symmetric_executor/src

1 file changed

+10
-1
lines changed

crates/symmetric_executor/src/lib.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,16 @@ impl symmetric_executor::GuestEventGenerator for EventGenerator {
4848
}
4949

5050
fn subscribe(&self) -> symmetric_executor::EventSubscription {
51-
todo!()
51+
let event_fd = unsafe { libc::eventfd(0, libc::EFD_NONBLOCK) };
52+
self.0.lock().unwrap().waiting.push(event_fd);
53+
symmetric_executor::EventSubscription::new(EventSubscription {
54+
inner: EventType::Triggered {
55+
last_counter: AtomicU32::new(0),
56+
event_fd,
57+
object: Arc::clone(&self.0),
58+
},
59+
callback: None,
60+
})
5261
}
5362

5463
fn activate(&self) -> () {

0 commit comments

Comments
 (0)