Boost logo

Boost :

From: Andreas Huber (ah2003_at_[hidden])
Date: 2004-05-24 09:56:35


David Abrahams <dave <at> boost-consulting.com> writes:

> > I'm not only saying this because an active state happens to be an
> > object in boost::fsm. State machines frequently acquire resources
> > in entry actions and dispose of them in exit actions. Those
> > resources would simply be leaked if there's no guarantee that exit
> > actions are called under all non-fatal error situations.
>
> It seems reasonable that well-designed state objects should also
> deallocate any resources they own in their destructors. It doesn't
> neccessarily seem reasonable as a consequence to force all exit
> actions into the state's destructor.

Are you proposing that an active state should still be represented by an
object, which acquires resources and executes entry actions in its
constructor, releases resources in its destructor but executes exit actions in
a separate function, which is called just before destructing the state object?

Regards,

Andreas


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk