
This is implemented as follows: * The parent coroutine allocates space for the return value in its frame and stores a pointer to this frame in the parent coroutine handle. * The child coroutine obtains the alloca from its parent using the parent coroutine handle. It then stores the result value there. * The parent value reads the data from the alloca on resumption.
13 строки
194 Б
Text
13 строки
194 Б
Text
main 1
|
|
sub 1
|
|
main 2
|
|
sub 2
|
|
main 3
|
|
wait:
|
|
wait start
|
|
wait end
|
|
end waiting
|
|
value produced after some time: 42
|
|
non-blocking goroutine
|
|
done with non-blocking goroutine
|
|
async interface method call
|