On 12/06/2016 03:55 PM, Thomas Heller wrote:
On Dienstag, 6. Dezember 2016 15:44:39 CET you wrote:
On Donnerstag, 1. Dezember 2016 21:45:52 CET Christophe Henry wrote:
<snip>
I didn't quite understand the state machine explanation - but I'll continue looking through the boost.asynchronous material until I am happier.
I tried to add an example and the underlying rationale (https://htmlpreview.github.io/?https://github.com/henry-ch/asynchronous/b lo b/master/libs/asynchronous/doc/asynchronous.html#d0e6437).
The Manager is a very simplified state machine but I hope you get the idea.
When looking at the example code, doesn't it contain a race on Manager::needs_second_task member. If not, how is it avoided?
So in this example, the race is avoided because it uses a single thread scheduler as the "thread world", right?
And because you use a proxy and post_callback.
What happens if I'd change it to run on multiple threads?
In this case you'd have to synchronize and it would make little sense, which is why servants are usually used within a single thread world.