Skip to content

Commit

Permalink
Std: delay
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanjermakov committed Apr 11, 2024
1 parent 7cd69ea commit 919940a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/std/future.no
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,11 @@ impl Runtime {
}
}

// TODO: use std::time::Duration
pub fn delay(delay: Int): Future<Unit> {
Future::new(|resolve| deferFor(|| resolve(unit), delay))
}

pub fn defer(f: ||: Unit): Unit {
deferFor(f, 0)
}
Expand Down

0 comments on commit 919940a

Please sign in to comment.