FIxed the timer and the example

This commit is contained in:
2023-10-12 15:01:19 +01:00
parent cb395da894
commit ff486a5f74
3 changed files with 10 additions and 8 deletions

View File

@@ -1,7 +0,0 @@
import system::async::(set_timer, yield)
import system::io::(readln, println)
const main := (
set_timer true 1 (println "y" yield)
\cancel. readln \a. cancel
)

9
examples/yes/main.orc Normal file
View File

@@ -0,0 +1,9 @@
import system::async::(set_timer, yield)
import system::io::(readln, println)
import std::exit_status
const main := (
set_timer true 1 (println "y" yield) \cancel.
readln \a.
cancel exit_status::success
)

View File

@@ -101,7 +101,7 @@ impl<TEv, TOnce, TRec: Clone + Send> Poller<TEv, TOnce, TRec> {
TimerKind::Recurring { period, data_cell } => {
let data = data_cell.clone_out()?;
self.timers.push(Timer {
expires,
expires: expires + period,
kind: TimerKind::Recurring { period, data_cell },
});
PollEvent::Recurring(data)