Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Better HN
Comment
by
astoilkov
· 2y ago · 0 comments
Yes, that's it. You choose where to pause/resume work and place the calls to `yieldOrContinue` there.
Comments
[–]
cryptonector
2y ago
The only gotcha is that you have to choose wisely. It's not a bad thing though. This is really cooperative multitasking all over again.
[–]
esprehn
2y ago
Pretty much, which is how browsers work in general with the single thread (ex. The html parser yields after a certain number of tokens or if user input is waiting).
React's concurrent mode is the same thing as well.