6 ms·
It is ... complicated when talking in the context of "threads modifying states". I am more thinking through "shared states" needs to be published after exiting
by liuliu 5y ago
It is ... complicated when talking in the context of "threads modifying states".
I am more thinking through "shared states" needs to be published after exiting a critical section [1], and other states are passed along from one critical section to another (either as copyable values, or immutable state objects). At least this is the easiest for me at the moment to reason about a piece of concurrency code.
[1] I am using critical section here to loosely describe a block of code needs to be executed together. It can be code between two yield points (in coroutine), a "task" object (in traditional task based scheduling), or section of code protected by a mutex.