Subject: Re: [boost] Boost MSM parallel behavior with delayed self-transitions?
From: Christophe Henry (christophe.j.henry_at_[hidden])
Date: 2017-03-23 20:11:35
>Thanks for the knowledge. It would be nice if you could give your opinion
on this question of mine regarding calling process_event from inside a
>I'd like to know if what Takatoshi Kondo answered is really the only way
to achieve the result, or if maybe there is a cleaner and more straight
I think he's mostly right, the self-join is the problem. Your timer thread
should not call anything which will join itself. I'm also afraid your
options are limited, exception or resource leak, none of them appeals to me.
I'll also add that the code is still wrong. stop_threads_ should not be
bool but atomic<bool> or mutexed. As it is now, it might work by luck on
some compilers and will fail on others because of optimizations.
Frankly, this is the point where you might want to pause, step back and
realize that no, it is not that easy and when your code grows, you'll be
debugging for ever.
This kind of code is simply hard if not impossible to maintain. With your
permission, I'd even want to add it to the doc of Asynchronous to show why
the library is needed. I would never manage to come up with such a good
I suggest you again to have a look at Asynchronous. For example:
Now imagine that your Servant would be a state machine, all you'd need
would be to call async_wait and enjoy having saved yourself quite some
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk