|
70 | 70 | (+ 5 10))))) |
71 | 71 | (test-result 15 res) |
72 | 72 | (print-result) |
73 | | - (event-loop-quit! main-loop) |
74 | | - (event-loop-block! #f main-loop)))) |
| 73 | + ;; we can apply event-loop-quit! here as we know the loop is running |
| 74 | + (event-loop-quit! main-loop)))) |
75 | 75 | (event-loop-run! main-loop) |
76 | 76 |
|
77 | 77 | ;; Test 3: await-task-in-thread! with handler |
78 | 78 |
|
79 | | -(event-loop-block! #t main-loop) |
80 | 79 | (a-sync (lambda (await resume) |
81 | 80 | (let ((res |
82 | 81 | (await-task-in-thread! |
|
87 | 86 | 5)))) |
88 | 87 | (test-result 5 res) |
89 | 88 | (print-result) |
90 | | - (event-loop-quit! main-loop) |
91 | | - (event-loop-block! #f main-loop)))) |
| 89 | + ;; we can apply event-loop-quit! here as we know the loop is running |
| 90 | + (event-loop-quit! main-loop)))) |
92 | 91 | (event-loop-run! main-loop) |
93 | 92 |
|
94 | 93 | ;; Test 4: await-task-in-event-loop! |
|
567 | 566 | (+ 5 10))))) |
568 | 567 | ((no-await (test-result 15 res) |
569 | 568 | (print-result) |
570 | | - (event-loop-quit! main-loop) |
571 | | - (event-loop-block! #f main-loop)))) |
| 569 | + ;; we can apply event-loop-quit! here as we know the loop is running |
| 570 | + (event-loop-quit! main-loop)))) |
572 | 571 | (event-loop-run! main-loop) |
573 | 572 |
|
574 | 573 | ;;;;;;;;;; now the same tests with a default event loop ;;;;;;;;;; |
|
600 | 599 | (+ 5 10))))) |
601 | 600 | (test-result 15 res) |
602 | 601 | (print-result) |
603 | | - (event-loop-quit!) |
604 | | - (event-loop-block! #f)))) |
| 602 | + ;; we can apply event-loop-quit! here as we know the loop is running |
| 603 | + (event-loop-quit!)))) |
605 | 604 | (event-loop-run!) |
606 | 605 |
|
607 | 606 | ;; Test 24: await-task-in-thread! without handler (explicit loop argument) |
608 | 607 |
|
609 | | -(event-loop-block! #t) |
610 | 608 | (a-sync (lambda (await resume) |
611 | 609 | (let ((res |
612 | 610 | (await-task-in-thread! await resume #f |
613 | 611 | (lambda () |
614 | 612 | (+ 5 10))))) |
615 | 613 | (test-result 15 res) |
616 | 614 | (print-result) |
617 | | - (event-loop-quit!) |
618 | | - (event-loop-block! #f)))) |
| 615 | + ;; we can apply event-loop-quit! here as we know the loop is running |
| 616 | + (event-loop-quit!)))) |
619 | 617 | (event-loop-run!) |
620 | 618 |
|
621 | 619 | ;; Test 25: await-task-in-thread! with handler |
622 | 620 |
|
623 | | -(event-loop-block! #t) |
624 | 621 | (a-sync (lambda (await resume) |
625 | 622 | (let ((res |
626 | 623 | (await-task-in-thread! |
|
631 | 628 | 5)))) |
632 | 629 | (test-result 5 res) |
633 | 630 | (print-result) |
634 | | - (event-loop-quit!) |
635 | | - (event-loop-block! #f)))) |
| 631 | + ;; we can apply event-loop-quit! here as we know the loop is running |
| 632 | + (event-loop-quit!)))) |
636 | 633 | (event-loop-run!) |
637 | 634 |
|
638 | 635 | ;; Test 26: await-task-in-event-loop! |
|
1120 | 1117 | (+ 5 10))))) |
1121 | 1118 | ((no-await (test-result 15 res) |
1122 | 1119 | (print-result) |
1123 | | - (event-loop-quit!) |
1124 | | - (event-loop-block! #f)))) |
| 1120 | + ;; we can apply event-loop-quit! here as we know the loop is running |
| 1121 | + (event-loop-quit!)))) |
1125 | 1122 | (event-loop-run!) |
0 commit comments