[Bug 1068] New: calling stop() of periodic task blocks until the current period ends

http://bugs.orocos.org/show_bug.cgi?id=1068

Summary: calling stop() of periodic task blocks until the
current period ends
Product: Toolchain
Version: master
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: P3
Component: RTT
AssignedTo: orocos-dev [..] ...
ReportedBy: dpoplavskiy [..] ...
CC: orocos-dev [..] ...
Estimated Hours: 0.0

Created attachment 876
--> http://bugs.orocos.org/attachment.cgi?id=876
test application

For the task with periodic activity (1 second for example)
calling

task.configure()
task.start()
task.stop()

blocks at stop() for one second.
This cause problems for tasks with large update interval.

This is caused by RTT::os::Thread::stop() trying to lock task->breaker:
MutexTimedLock lock(breaker, getStopTimeout() );

while the same mutex is locked by periodic activity thread:
MutexLock lock(task->breaker);

while calling rtos_task_wait_period(task->getTask())

I'd expect the breaker mutex to protect task->step() and some housekeeping, but
not sleeping between updates.