|
Boost : |
Subject: Re: [boost] Asynchronous library now in Boost Library Incubator
From: Christophe Henry (christophe.j.henry_at_[hidden])
Date: 2016-12-06 15:07:26
On 12/06/2016 03:44 PM, Thomas Heller 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/blo
>> 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?
No it doesn't. This is the point. We have at least three threads in the
game, no mutex and no race.
It is avoided because main thread does not access the servant and its
attributes directly but through a proxy object, and because the callback
is posted into the servant thread.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk