2019-10-06 20:45:57 -04:00
|
|
|
//! A version of the `aeronmd` runner program demonstrating the Rust wrappers
|
|
|
|
//! around Media Driver functionality.
|
|
|
|
use aeron_rs::driver::DriverContext;
|
2019-09-22 18:58:34 -04:00
|
|
|
use std::sync::atomic::{AtomicBool, Ordering};
|
|
|
|
|
2019-10-06 20:45:57 -04:00
|
|
|
static RUNNING: AtomicBool = AtomicBool::new(false);
|
2019-10-06 18:17:28 -04:00
|
|
|
|
2019-09-22 18:58:34 -04:00
|
|
|
fn main() {
|
2019-10-06 20:45:57 -04:00
|
|
|
let driver = DriverContext::default()
|
|
|
|
.build()
|
|
|
|
.expect("Unable to create media driver");
|
2019-09-22 18:58:34 -04:00
|
|
|
|
2019-10-06 20:45:57 -04:00
|
|
|
let driver = driver.start().expect("Unable to start media driver");
|
|
|
|
RUNNING.store(true, Ordering::SeqCst);
|
2019-09-22 18:58:34 -04:00
|
|
|
|
2019-10-06 20:45:57 -04:00
|
|
|
println!("Press Ctrl-C to quit");
|
2019-09-22 18:58:34 -04:00
|
|
|
|
2019-10-06 20:45:57 -04:00
|
|
|
while RUNNING.load(Ordering::SeqCst) {
|
|
|
|
// TODO: Termination hook
|
|
|
|
driver.do_work();
|
2019-09-22 18:58:34 -04:00
|
|
|
}
|
|
|
|
}
|