Switched while-loop with call to simple monitor-class