Boost logo

Boost :

From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2008-08-08 14:15:32


On Friday 08 August 2008 21:52:50 Rajpal Dangi wrote:
> Hi All,
> Is it possible to use FSM in multithreaded application i.e. each
> worker thread executing its own statemachine? I would have assumed to
> accomplish so but doubt occurred after reading FSM docs
> "Users should consider Boost.FSM if
> * the state machine don't need to be executed in a separate thread"
>
> Is there any problem if each thread has a separate FSM instance and
> process events as per its context?

It's perfectly safe to run a separate state machine in each thread. There is
also a state machine class that uses locking to provide a safe way to process
events from different threads in a single instance of the machine.

The note in the docs you are referring to just says the Boost.FSM does not
provide asynchronous machines, i.e. when the machine runs in its own thread
and processes events from a thread-safe queue.


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