Skip to content

Commit f656ed7

Browse files
committed
Added ability to sleep forever
1 parent 5bee5ac commit f656ed7

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/processes/process_system.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,7 @@ class ProcessSystem {
2424

2525
let process_system_scope = this;
2626
this.main_process_pid = this.spawn(function*(){
27-
while(true){
28-
yield process_system_scope.sleep(10000);
29-
}
27+
yield process_system_scope.sleep(Symbol.for("Infinity"));
3028
});
3129
this.set_current(this.main_process_pid);
3230
}
@@ -246,7 +244,10 @@ class ProcessSystem {
246244

247245
delay(fun, time){
248246
this.current_process.status = States.SLEEPING;
249-
this.scheduler.scheduleFuture(this.current_process.pid, time, fun);
247+
248+
if(Number.isInteger(time)){
249+
this.scheduler.scheduleFuture(this.current_process.pid, time, fun);
250+
}
250251
}
251252

252253
schedule(fun, pid){

0 commit comments

Comments
 (0)