Skip to content

Commit cff8a5e

Browse files
committed
Update index.md
1 parent 1f94b57 commit cff8a5e

File tree

1 file changed

+37
-269
lines changed

1 file changed

+37
-269
lines changed

docs/index.md

Lines changed: 37 additions & 269 deletions
Original file line numberDiff line numberDiff line change
@@ -298,62 +298,16 @@ int co_main(int argc, char **argv)
298298
<summary>DEBUG run output</summary>
299299
300300
<pre>
301-
Thread #7f11090f11c0 running coroutine id: 1 () status: x cycles: x
302301
Start of main Goroutine
303-
Back at coroutine scheduling
304-
Thread #7f11090f11c0 running coroutine id: 2 () status: x cycles: x
305302
0 ==> John
306-
Back at coroutine scheduling
307-
Thread #7f11090f11c0 running coroutine id: 3 () status: x cycles: x
308303
0 ==> Mary
309-
Back at coroutine scheduling
310-
Thread #7f11090f11c0 running coroutine id: 4 () status: x cycles: x
311-
Back at coroutine scheduling
312-
Thread #7f11090f11c0 running coroutine id: 4 (coroutine_wait) status: x cycles: x
313-
Back at coroutine scheduling
314-
Thread #7f11090f11c0 running coroutine id: 2 () status: x cycles: x
304+
1 ==> Mary - Thrd #c080080, cid: 4 (coroutine_wait) Active/Running cycles: 18
315305
1 ==> John
316-
Back at coroutine scheduling
317-
Thread #7f11090f11c0 running coroutine id: 3 () status: x cycles: x
318-
1 ==> Mary
319-
Back at coroutine scheduling
320-
Thread #7f11090f11c0 running coroutine id: 4 (coroutine_wait) status: x cycles: x
321-
Back at coroutine scheduling
322-
Thread #7f11090f11c0 running coroutine id: 4 (coroutine_wait) status: x cycles: x
323-
Back at coroutine scheduling
324-
Thread #7f11090f11c0 running coroutine id: 2 () status: x cycles: x
325-
2 ==> John
326-
Back at coroutine scheduling
327-
Thread #7f11090f11c0 running coroutine id: 3 () status: x cycles: x
306+
2 ==> John - Thrd #c080080, cid: 4 (coroutine_wait) Active/Running cycles: 99
328307
2 ==> Mary
329-
Back at coroutine scheduling
330-
Thread #7f11090f11c0 running coroutine id: 4 (coroutine_wait) status: x cycles: x
331-
Back at coroutine scheduling
332-
Thread #7f11090f11c0 running coroutine id: 4 (coroutine_wait) status: x cycles: x
333-
Back at coroutine scheduling
334-
Thread #7f11090f11c0 running coroutine id: 2 () status: x cycles: x
335-
Back at coroutine scheduling
336-
Thread #7f11090f11c0 running coroutine id: 3 () status: x cycles: x
337-
Back at coroutine scheduling
338-
Thread #7f11090f11c0 running coroutine id: 4 (coroutine_wait) status: x cycles: x
339-
Back at coroutine scheduling
340-
Thread #7f11090f11c0 running coroutine id: 4 (coroutine_wait) status: x cycles: x
341-
Back at coroutine scheduling
342-
Thread #7f11090f11c0 running coroutine id: 4 (coroutine_wait) status: x cycles: x
343-
Back at coroutine scheduling
344-
Thread #7f11090f11c0 running coroutine id: 4 (coroutine_wait) status: x cycles: x
345-
Back at coroutine scheduling
346-
...
347-
...
348-
...
349-
...
350-
Thread #7f6ac8aa11c0 running coroutine id: 4 (coroutine_wait) status: x cycles: x
351-
Back at coroutine scheduling
352-
Thread #7f6ac8aa11c0 running coroutine id: 4 (coroutine_wait) status: x cycles: x
353-
Back at coroutine scheduling
354-
Thread #7f6ac8aa11c0 running coroutine id: 1 (co_main) status: x cycles: x
308+
- Thrd #c080080, cid: 4 (coroutine_wait) Active/Running cycles: 8404
355309
End of main Goroutine
356-
Back at coroutine scheduling
310+
357311
Coroutine scheduler exited
358312
</pre>
359313
</details>
@@ -427,19 +381,14 @@ int co_main(int argc, char **argv) {
427381
<summary>DEBUG run output</summary>
428382
429383
<pre>
430-
Thread #7f87171711c0 running coroutine id: 1 () status: x cycles: x
431384
processed
432-
r:0x7fffb878dca0
433-
Back at coroutine scheduling
434-
Thread #7f87171711c0 running coroutine id: 2 () status: x cycles: x
385+
r:000002592E480080
435386
processed
436-
s:0x7fffb878dca0*
437-
=> s:0x7fffb878dca0
387+
s:000002592E480080*
388+
=> s:000002592E480080
438389
No receiver! Send Operation Blocked
439-
Back at coroutine scheduling
440-
Thread #7f87171711c0 running coroutine id: 1 (co_main) status: x cycles: x
441390
Received. Send Operation Successful
442-
Back at coroutine scheduling
391+
443392
Coroutine scheduler exited
444393
</pre>
445394
</details>
@@ -532,129 +481,6 @@ int co_main(int argc, char **argv) {
532481
</tr>
533482
</table>
534483
535-
<details>
536-
<summary>DEBUG run output</summary>
537-
538-
<pre>
539-
Thread #7f2dadbb11c0 running coroutine id: 1 () status: x cycles: x
540-
Back at coroutine scheduling
541-
Thread #7f2dadbb11c0 running coroutine id: 2 () status: x cycles: x
542-
processed
543-
r:0x7fffc1f35ca0
544-
Back at coroutine scheduling
545-
Thread #7f2dadbb11c0 running coroutine id: 1 (co_main) status: x cycles: x
546-
processed
547-
s:0x7fffc1f35ca0*
548-
=> s:0x7fffc1f35ca0
549-
Back at coroutine scheduling
550-
Thread #7f2dadbb11c0 running coroutine id: 2 () status: x cycles: x
551-
0
552-
processed
553-
r:0x7fffc1f35ca0
554-
Back at coroutine scheduling
555-
Thread #7f2dadbb11c0 running coroutine id: 1 (co_main) status: x cycles: x
556-
processed
557-
s:0x7fffc1f35ca0*
558-
=> s:0x7fffc1f35ca0
559-
Back at coroutine scheduling
560-
Thread #7f2dadbb11c0 running coroutine id: 2 () status: x cycles: x
561-
1
562-
processed
563-
r:0x7fffc1f35ca0
564-
Back at coroutine scheduling
565-
Thread #7f2dadbb11c0 running coroutine id: 1 (co_main) status: x cycles: x
566-
processed
567-
s:0x7fffc1f35ca0*
568-
=> s:0x7fffc1f35ca0
569-
Back at coroutine scheduling
570-
Thread #7f2dadbb11c0 running coroutine id: 2 () status: x cycles: x
571-
1
572-
processed
573-
r:0x7fffc1f35ca0
574-
Back at coroutine scheduling
575-
Thread #7f2dadbb11c0 running coroutine id: 1 (co_main) status: x cycles: x
576-
processed
577-
s:0x7fffc1f35ca0*
578-
=> s:0x7fffc1f35ca0
579-
Back at coroutine scheduling
580-
Thread #7f2dadbb11c0 running coroutine id: 2 () status: x cycles: x
581-
2
582-
processed
583-
r:0x7fffc1f35ca0
584-
Back at coroutine scheduling
585-
Thread #7f2dadbb11c0 running coroutine id: 1 (co_main) status: x cycles: x
586-
processed
587-
s:0x7fffc1f35ca0*
588-
=> s:0x7fffc1f35ca0
589-
Back at coroutine scheduling
590-
Thread #7f2dadbb11c0 running coroutine id: 2 () status: x cycles: x
591-
3
592-
processed
593-
r:0x7fffc1f35ca0
594-
Back at coroutine scheduling
595-
Thread #7f2dadbb11c0 running coroutine id: 1 (co_main) status: x cycles: x
596-
processed
597-
s:0x7fffc1f35ca0*
598-
=> s:0x7fffc1f35ca0
599-
Back at coroutine scheduling
600-
Thread #7f2dadbb11c0 running coroutine id: 2 () status: x cycles: x
601-
5
602-
processed
603-
r:0x7fffc1f35ca0
604-
Back at coroutine scheduling
605-
Thread #7f2dadbb11c0 running coroutine id: 1 (co_main) status: x cycles: x
606-
processed
607-
s:0x7fffc1f35ca0*
608-
=> s:0x7fffc1f35ca0
609-
Back at coroutine scheduling
610-
Thread #7f2dadbb11c0 running coroutine id: 2 () status: x cycles: x
611-
8
612-
processed
613-
r:0x7fffc1f35ca0
614-
Back at coroutine scheduling
615-
Thread #7f2dadbb11c0 running coroutine id: 1 (co_main) status: x cycles: x
616-
processed
617-
s:0x7fffc1f35ca0*
618-
=> s:0x7fffc1f35ca0
619-
Back at coroutine scheduling
620-
Thread #7f2dadbb11c0 running coroutine id: 2 () status: x cycles: x
621-
13
622-
processed
623-
r:0x7fffc1f35ca0
624-
Back at coroutine scheduling
625-
Thread #7f2dadbb11c0 running coroutine id: 1 (co_main) status: x cycles: x
626-
processed
627-
s:0x7fffc1f35ca0*
628-
=> s:0x7fffc1f35ca0
629-
Back at coroutine scheduling
630-
Thread #7f2dadbb11c0 running coroutine id: 2 () status: x cycles: x
631-
21
632-
processed
633-
r:0x7fffc1f35ca0
634-
Back at coroutine scheduling
635-
Thread #7f2dadbb11c0 running coroutine id: 1 (co_main) status: x cycles: x
636-
processed
637-
s:0x7fffc1f35ca0*
638-
=> s:0x7fffc1f35ca0
639-
Back at coroutine scheduling
640-
Thread #7f2dadbb11c0 running coroutine id: 2 () status: x cycles: x
641-
34
642-
processed
643-
s:0x7fffc1f35f10
644-
Back at coroutine scheduling
645-
Thread #7f2dadbb11c0 running coroutine id: 1 (co_main) status: x cycles: x
646-
processed
647-
r:0x7fffc1f35f10*
648-
=> r:0x7fffc1f35f10
649-
quit
650-
Back at coroutine scheduling
651-
Thread #7f2dadbb11c0 running coroutine id: 2 () status: x cycles: x
652-
Back at coroutine scheduling
653-
Coroutine scheduler exited
654-
655-
</pre>
656-
</details>
657-
658484
Original **Go** example from <https://www.developer.com/languages/go-error-handling-with-panic-recovery-and-defer/>
659485
660486
<table>
@@ -733,15 +559,10 @@ int co_main(int argc, char **argv) {
733559
<summary>DEBUG run output</summary>
734560
735561
<pre>
736-
Thread #7fd29c4011c0 running coroutine id: 1 () status: x cycles: x
737-
Back at coroutine scheduling
738-
Thread #7fd29c4011c0 running coroutine id: 2 () status: x cycles: x
739-
panic occurred: sig_ill
740-
Back at coroutine scheduling
741-
Thread #7fd29c4011c0 running coroutine id: 1 (co_main) status: x cycles: x
562+
panic occurred: divide_by_zero
742563
Although panicked. We recovered. We call mul() func
743564
mul func result: 50
744-
Back at coroutine scheduling
565+
745566
Coroutine scheduler exited
746567
</pre>
747568
</details>
@@ -836,64 +657,31 @@ int co_main(int argc, char **argv)
836657
<summary>DEBUG run output</summary>
837658
838659
<pre>
839-
Thread #7f48f6c211c0 running coroutine id: 1 () status: x cycles: x
840-
Back at coroutine scheduling
841-
Thread #7f48f6c211c0 running coroutine id: 2 () status: x cycles: x
660+
Worker 1 starting
661+
- Thrd #a38e0080, cid: 2 () Active/Running cycles: 1
842662
Worker 2 starting
843-
Back at coroutine scheduling
844-
Thread #7f48f6c211c0 running coroutine id: 3 () status: x cycles: x
663+
- Thrd #a38e0080, cid: 3 () Active/Running cycles: 1
845664
Worker 3 starting
846-
Back at coroutine scheduling
847-
Thread #7f48f6c211c0 running coroutine id: 4 () status: x cycles: x
665+
- Thrd #a38e0080, cid: 4 () Active/Running cycles: 1
848666
Worker 4 starting
849-
Back at coroutine scheduling
850-
Thread #7f48f6c211c0 running coroutine id: 5 () status: x cycles: x
667+
- Thrd #a38e0080, cid: 5 () Active/Running cycles: 1
851668
Worker 5 starting
852-
Back at coroutine scheduling
853-
Thread #7f48f6c211c0 running coroutine id: 6 () status: x cycles: x
854-
Worker 6 starting
855-
Back at coroutine scheduling
856-
Thread #7f48f6c211c0 running coroutine id: 1 (co_main) status: x cycles: x
857-
Back at coroutine scheduling
858-
Thread #7f48f6c211c0 running coroutine id: 7 () status: x cycles: x
859-
Back at coroutine scheduling
860-
Thread #7f48f6c211c0 running coroutine id: 6 () status: x cycles: x
861-
Worker 6 done
862-
Back at coroutine scheduling
863-
Thread #7f48f6c211c0 running coroutine id: 1 (co_main) status: x cycles: x
864-
Back at coroutine scheduling
865-
Thread #7f48f6c211c0 running coroutine id: 7 (coroutine_wait) status: x cycles: x
866-
Back at coroutine scheduling
867-
Thread #7f48f6c211c0 running coroutine id: 5 () status: x cycles: x
868-
Worker 5 done
869-
Back at coroutine scheduling
870-
Thread #7f48f6c211c0 running coroutine id: 1 (co_main) status: x cycles: x
871-
Back at coroutine scheduling
872-
Thread #7f48f6c211c0 running coroutine id: 7 (coroutine_wait) status: x cycles: x
873-
Back at coroutine scheduling
874-
Thread #7f48f6c211c0 running coroutine id: 4 () status: x cycles: x
875-
Worker 4 done
876-
Back at coroutine scheduling
877-
Thread #7f48f6c211c0 running coroutine id: 1 (co_main) status: x cycles: x
878-
Back at coroutine scheduling
879-
Thread #7f48f6c211c0 running coroutine id: 7 (coroutine_wait) status: x cycles: x
880-
Back at coroutine scheduling
881-
Thread #7f48f6c211c0 running coroutine id: 3 () status: x cycles: x
882-
Worker 3 done
883-
Back at coroutine scheduling
884-
Thread #7f48f6c211c0 running coroutine id: 1 (co_main) status: x cycles: x
885-
Back at coroutine scheduling
886-
Thread #7f48f6c211c0 running coroutine id: 7 (coroutine_wait) status: x cycles: x
887-
Back at coroutine scheduling
888-
Thread #7f48f6c211c0 running coroutine id: 2 () status: x cycles: x
889-
Worker 2 done
890-
Back at coroutine scheduling
891-
Thread #7f48f6c211c0 running coroutine id: 1 (co_main) status: x cycles: x
669+
- Thrd #a38e0080, cid: 6 () Active/Running cycles: 1
670+
Worker 5 done - Thrd #a38e0080, cid: 1 (co_main) Active/Running cycles: 2
671+
- Thrd #a38e0080, cid: 6 () Active/Running cycles: 2
672+
Worker 2 done - Thrd #a38e0080, cid: 1 (co_main) Active/Running cycles: 3
673+
- Thrd #a38e0080, cid: 3 () Active/Running cycles: 2
674+
Worker 3 done - Thrd #a38e0080, cid: 1 (co_main) Active/Running cycles: 4
675+
- Thrd #a38e0080, cid: 4 () Active/Running cycles: 2
676+
Worker 1 done - Thrd #a38e0080, cid: 1 (co_main) Active/Running cycles: 5
677+
- Thrd #a38e0080, cid: 2 () Active/Running cycles: 2
678+
Worker 4 done - Thrd #a38e0080, cid: 1 (co_main) Active/Running cycles: 6
679+
- Thrd #a38e0080, cid: 5 () Active/Running cycles: 2
892680
893681
Worker # 4 returned: 32
894682
895683
Worker # 3 returned: hello world
896-
Back at coroutine scheduling
684+
897685
Coroutine scheduler exited
898686
</pre>
899687
</details>
@@ -981,37 +769,17 @@ int co_main(int argc, char **argv) {
981769
<summary>DEBUG run output</summary>
982770
983771
<pre>
984-
Thread #7fc61b3d11c0 running coroutine id: 1 () status: x cycles: x
985-
promise id(706099430) created in thread #7fc61b3d11c0
986-
thread #7fc61b3d11c0 created thread #7fc61b2b0700 with status(0) future id(706099430)
772+
promise id(16038) created in thread #18d80080
773+
thread #18d80080 created thread #18d80130 with status(0) future id(16038)
987774
checking...
988-
Back at coroutine scheduling
989-
Thread #7fc61b3d11c0 running coroutine id: 1 (co_main) status: x cycles: x
990-
Back at coroutine scheduling
991-
Thread #7fc61b3d11c0 running coroutine id: 1 (co_main) status: x cycles: x
992-
Back at coroutine scheduling
993-
Thread #7fc61b3d11c0 running coroutine id: 1 (co_main) status: x cycles: x
994-
Back at coroutine scheduling
995-
...
996-
...
997-
...
998-
...
999-
Thread #7fc61b3d11c0 running coroutine id: 1 (co_main) status: x cycles: x
1000-
Back at coroutine scheduling
1001-
Thread #7fc61b3d11c0 running coroutine id: 1 (co_main) status: x cycles: x
1002-
Back at coroutine scheduling
1003-
Thread #7fc61b3d11c0 running coroutine id: 1 (co_main) status: x cycles: x
1004-
Back at coroutine scheduling
1005-
promise id(706099430) set LOCK in thread #7fc61b2b0700
1006-
promise id(706099430) set UNLOCK in thread #7fc61b2b0700
1007-
Thread #7fc61b3d11c0 running coroutine id: 1 (co_main) status: x cycles: x
1008-
Back at coroutine scheduling
1009-
Thread #7fc61b3d11c0 running coroutine id: 1 (co_main) status: x cycles: x
1010-
1011-
194232491 promise id(706099430) get LOCK in thread #7fc61b3d11c0
1012-
promise id(706099430) get UNLOCK in thread #7fc61b3d11c0
1013-
is prime!
1014-
Back at coroutine scheduling
775+
promise id(16038) set LOCK in thread #18d80130
776+
promise id(16038) set UNLOCK in thread #18d80130
777+
- Thrd #18d80080, cid: 1 (co_main) Active/Running cycles: 34289
778+
194232491
779+
promise id(16038) get LOCK in thread #18d80080
780+
promise id(16038) get UNLOCK in thread #18d80080
781+
is prime.
782+
1015783
Coroutine scheduler exited
1016784
</pre>
1017785
</details>

0 commit comments

Comments
 (0)