Boost logo

Boost :

Subject: [boost] thread monitor
From: Qihong Wang (qihongwang_at_[hidden])
Date: 2009-01-30 19:13:55


I have a service thread and a monitor thread in my program. Currently I use
pthread. The service send and receive data and process it by speech
recognition and update DB. Service thread may be hung some where because of
a unknown bug. So the service thread update its state to a global activity
object. The monitor check the activity object every 30 seconds. If the state
of service thread is not idle and the span between updating time and current
time is larger than a threshold, then monitor considers service thread is
hung and kill it and restart a new service thread. This implementation has
at least two flaws. It can't discover thread in hung immediately. It's hard
to provide a optimal threshold. Because speech recognition may take short or
long time to process different data. I just started to use boost and read
some sample code using boost thread. I'm wondering whether I can have a
better solution by using boost thread and how to do it?



Boost list run by bdawes at, gregod at, cpdaniel at, john at