no need for separate vars
parent
972c27e181
commit
f3984f6412
|
@ -27,8 +27,7 @@ int main() {
|
|||
* implementing a 1:1 (kernel-level) scheduling - very expensive on
|
||||
* Windows, less expensive on Unix-likes (but more than coroutines)
|
||||
*/
|
||||
thread_scheduler tsched;
|
||||
tsched.start([&foo]() {
|
||||
thread_scheduler{}.start([&foo]() {
|
||||
writeln("(1) 1:1 scheduler: starting...");
|
||||
foo();
|
||||
writeln("(1) 1:1 scheduler: finishing...");
|
||||
|
@ -39,8 +38,7 @@ int main() {
|
|||
* per task, implementing N:1 (user-level) scheduling - very cheap
|
||||
* and portable everywhere but obviously limited to only one thread
|
||||
*/
|
||||
simple_coroutine_scheduler scsched;
|
||||
scsched.start([&foo]() {
|
||||
simple_coroutine_scheduler{}.start([&foo]() {
|
||||
writeln("(2) N:1 scheduler: starting...");
|
||||
foo();
|
||||
writeln("(2) N:1 scheduler: finishing...");
|
||||
|
@ -52,8 +50,7 @@ int main() {
|
|||
* a hybrid M:N approach - this benefits from multicore systems and
|
||||
* also is relatively cheap (you can create a big number of tasks)
|
||||
*/
|
||||
coroutine_scheduler csched;
|
||||
csched.start([&foo]() {
|
||||
coroutine_scheduler{}.start([&foo]() {
|
||||
writeln("(3) M:N scheduler: starting...");
|
||||
foo();
|
||||
writeln("(3) M:N scheduler: finishing...");
|
||||
|
|
Loading…
Reference in New Issue