3 ms·
You're describing exactly why it's painful for threads. If you only cancel co-routines at yield points (which unless you do dark magic is the only time you can
by Spivak 3y ago
You're describing exactly why it's painful for threads. If you only cancel co-routines at yield points (which unless you do dark magic is the only time you can cancel them) is always safe.
A co-routine that yields in the middle of an atomic operation is an oxymoron. Anything can happen before you're scheduled again.