-
Notifications
You must be signed in to change notification settings - Fork 0
/
tasks.rs
35 lines (30 loc) · 862 Bytes
/
tasks.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
extern crate rvb as v8;
use v8::v8::{
Platform,
Isolate,
};
pub fn main() {
let _platform = Platform::New();
let mut isolate = Isolate::New();
isolate.enqueue_closure(|| {
println!("Hello from enqueued closure. #1");
});
isolate.enqueue_closure(|| {
println!("Hello from enqueued closure. #2");
});
isolate.enqueue_closure(|| {
println!("Hello from enqueued closure. #3");
});
isolate.enqueue_closure(|| {
println!("Hello from enqueued closure. #4");
});
isolate.enqueue_closure(|| {
println!("Hello from enqueued closure. #5");
});
let policy = isolate.get_microtasks_policy();
println!("default policy: {}", policy);
isolate.add_microtasks_completed_closure(|_| {
println!("microtasks completed.");
});
isolate.run_microtasks();
}