First of all, thank you for all the knowledge of this web&forum; I've learnt a lot, and I hope to learn more here.
I've just started with Boost library, and I've got a doubt about critical sections: which option is better (and when), mutex or Coroutine (from boost)?
That's like asking if functions are better than variables. They do different things.
A mutex is a synchronization primitive, most often used to prevent multiple threads from accessing the same data concurrently.
Coroutines are a kind of execution model that allow a function to be paused and later resumed where it left off, while maintaining all the context as it was when it was paused, including values of local variables and the call stack. Coroutines are similar to threads, in that they allow concurrency[1] within the same address space. They're different in that they do not allow parallelism[2] and in that they support cooperative, instead of preemptive, multitasking.
[1] Concurrency means that more than one separate computation may execute before any of them finish. This may happen in an interleaved manner or in a parallel manner.
[2] Parallelism means that more than one separate computation executes at the same time.
An example of non-parallel concurrency would be a baker who must bake a cake and make a loaf of bread, and alternates between one and the other to finish on time. If he bakes the cake completely first, and then makes the bread (or viceversa) that's non-concurrent execution. If there are two bakers and one bakes the cake as the other makes the bread, that's parallel concurrent execution.