Report
5 months, 1 week ago.

How to break EventQueue dispatch

Hello, i need to break the EventQueue dispatcher for a thread connected to an interrupt. After having called the break_dispatch() the related thread internal _tid become 0, this destroy the thread making impossible to restart it again despite the fact that the thread is a class variable. My question: is it possible to break_dispatch and than start it again without destroying the connected thread ? if yes how? The design pattern i'm using is below, at first run it works, but after having called stop() calling the start() again it fails:

System start:

Class myComp {
.....
Thread _ISRthread;
EventQueue _ISRqueue;

void ThreadBodyFunc () {
// my stuff without endless loop
}

void start() {
_ISRthread.start(callback(&_ISRqueue, &EventQueue::dispatch_forever));
_ISRthread.set_priority(osPriorityRealtime);   // after having called break_dispatch it FAILS with "Thread 00000000 error -4: Parameter error"
_IRQPin.rise(_ISRqueue.event(this, &myComp ::ThreadBodyFunc ));
...
}

void stop() {
_ISRqueue.break_dispatch();
}

}
Comment on this question
Be the first to answer this question.

To post an answer, please log in.