()
| 113 | |
| 114 | #[test] |
| 115 | fn create_and_signal() { |
| 116 | let efd = EventFd::new().unwrap(); |
| 117 | let notifier = efd.notifier(); |
| 118 | |
| 119 | // No signals yet. |
| 120 | assert_eq!(efd.drain(), 0); |
| 121 | |
| 122 | // Signal and drain. |
| 123 | notifier.notify(); |
| 124 | assert_eq!(efd.drain(), 1); |
| 125 | |
| 126 | // Drained — should be 0 again. |
| 127 | assert_eq!(efd.drain(), 0); |
| 128 | } |
| 129 | |
| 130 | #[test] |
| 131 | fn multiple_signals_accumulate() { |