Coroutine vs Continuation vs Generator

后端 未结 3 1066
伪装坚强ぢ
伪装坚强ぢ 2020-12-02 03:28

What is the difference between a coroutine and a continuation and a generator ?

3条回答
  •  再見小時候
    2020-12-02 04:19

    Coroutine is one of several procedures that take turns doing their job and then pause to give control to the other coroutines in the group.

    Continuation is a "pointer to a function" you pass to some procedure, to be executed ("continued with") when that procedure is done.

    Generator (in .NET) is a language construct that can spit out a value, "pause" execution of the method and then proceed from the same point when asked for the next value.

提交回复
热议问题