stopping non-periodic activity

Hi,

I'm implementing a non-periodic activity and when it stops, I would like
it to do it correctly :)
But he gives me an error:

Got :Polaris.stop()
17.919 [ Warning][Polaris] Failed to stop thread NonPeriodicActivity:
breakLoop() returned false.
= falseSo it seems that he doesn't want to stop the updateHook()
In the manual there is something that says:
Since the activity may be blocked in the user's loop() function, the
user must reimplement the RunnableInterface::breakLoop() function

How do you do this?
Has anyone an example?

thanx!

nick

stopping non-periodic activity

On Jun 16, 2010, at 03:22 , Dominick Vanthienen wrote:

> Hi,
>
> I'm implementing a non-periodic activity and when it stops, I would like it to do it correctly :)
> But he gives me an error:
>
> Got :Polaris.stop()
> 17.919 [ Warning][Polaris] Failed to stop thread NonPeriodicActivity: breakLoop() returned false.
> = false
> So it seems that he doesn't want to stop the updateHook()
> In the manual there is something that says:
> Since the activity may be blocked in the user's loop() function, the
> user must reimplement the RunnableInterface::breakLoop() function
>
> How do you do this?
> Has anyone an example?
>
> thanx!
>
> nick

Use breakUpdateHook() instead. See example at

http://orocos.org/wiki/rtt/simple-examples/simple-tcp-client-using-non-b...

HTH
S

stopping non-periodic activity

[...]
> I'm implementing a non-periodic activity and when it stops, I would like it
> to do it correctly :)
> But he gives me an error:
>
> Got :Polaris.stop()
> 17.919 [ Warning][Polaris] Failed to stop thread NonPeriodicActivity:
> breakLoop() returned false.
> = false
> So it seems that he doesn't want to stop the updateHook()
> In the manual there is something that says:
> Since the activity may be blocked in the user's loop() function, the
> user must reimplement the RunnableInterface::breakLoop() function
>
> How do you do this?
> Has anyone an example?
>
> thanx!
>
> nick
>
>
> Use breakUpdateHook() instead. See example at
>
>
> http://orocos.org/wiki/rtt/simple-examples/simple-tcp-client-using-non-b...
>
> HTH
> S
>
>
> Thank you Stephen and Klaas!
> btw I read on the wiki:
> "The breakUpdateHook() is very important, as it is the only way to inform a
> blocked updateHook() that it is time to return and quit. In this example we
> set the quit flag and return true. The quit flag will be picked up by
> updateHook() when it finishes waiting for data (in
> socket->waitForReadyRead()). Returning true from stopHook() tells the
> execution engine that we successfully told updateHook() to return and that
> it should wait (forever if need be) for updateHook() to complete and return.
> If we returned false, then the system would attempt to terminate
> updateHook() forcibly."
>
> I suppose it should be
> ...Returning true from _breakUpdateHook()_ tells the execution engine .....
> ?

I think (but the example was kindly contributed by stephen).
However, according to
<http://svn.mech.kuleuven.be/websvn/orocos/branches/rtt/rtt-1.10/src/os/Thread.cpp>

I think it should rather read something like

Returning true from breakUpdateHook() tells the execution engine that
we successfully told updateHook() to return and that
it should wait (one second, hardcoded) for updateHook() to complete
and return. If we returned false, then stop would also return false.

Stephen, what do you think? (If it's correct, we can let Nick update
the wiki ;-)

Klaas

stopping non-periodic activity

On 06/17/2010 10:23 AM, Klaas Gadeyne wrote:
> [...]
>
>> I'm implementing a non-periodic activity and when it stops, I would like it
>> to do it correctly :)
>> But he gives me an error:
>>
>> Got :Polaris.stop()
>> 17.919 [ Warning][Polaris] Failed to stop thread NonPeriodicActivity:
>> breakLoop() returned false.
>> = false
>> So it seems that he doesn't want to stop the updateHook()
>> In the manual there is something that says:
>> Since the activity may be blocked in the user's loop() function, the
>> user must reimplement the RunnableInterface::breakLoop() function
>>
>> How do you do this?
>> Has anyone an example?
>>
>> thanx!
>>
>> nick
>>
>>
>> Use breakUpdateHook() instead. See example at
>>
>>
>> http://orocos.org/wiki/rtt/simple-examples/simple-tcp-client-using-non-b...
>>
>> HTH
>> S
>>
>>
>> Thank you Stephen and Klaas!
>> btw I read on the wiki:
>> "The breakUpdateHook() is very important, as it is the only way to inform a
>> blocked updateHook() that it is time to return and quit. In this example we
>> set the quit flag and return true. The quit flag will be picked up by
>> updateHook() when it finishes waiting for data (in
>> socket->waitForReadyRead()). Returning true from stopHook() tells the
>> execution engine that we successfully told updateHook() to return and that
>> it should wait (forever if need be) for updateHook() to complete and return.
>> If we returned false, then the system would attempt to terminate
>> updateHook() forcibly."
>>
>> I suppose it should be
>> ...Returning true from _breakUpdateHook()_ tells the execution engine .....
>> ?
>>
> I think (but the example was kindly contributed by stephen).
> However, according to
> <http://svn.mech.kuleuven.be/websvn/orocos/branches/rtt/rtt-1.10/src/os/Thread.cpp>
>
> I think it should rather read something like
>
> Returning true from breakUpdateHook() tells the execution engine that
> we successfully told updateHook() to return and that
> it should wait (one second, hardcoded) for updateHook() to complete
> and return. If we returned false, then stop would also return false.
>
> Stephen, what do you think? (If it's correct, we can let Nick update
> the wiki ;-)
>
> Klaas
>
I changed it already to my proposal ;)

stopping non-periodic activity

On Jun 17, 2010, at 04:23 , Klaas Gadeyne wrote:

> [...]
>> I'm implementing a non-periodic activity and when it stops, I would like it
>> to do it correctly :)
>> But he gives me an error:
>>
>> Got :Polaris.stop()
>> 17.919 [ Warning][Polaris] Failed to stop thread NonPeriodicActivity:
>> breakLoop() returned false.
>> = false
>> So it seems that he doesn't want to stop the updateHook()
>> In the manual there is something that says:
>> Since the activity may be blocked in the user's loop() function, the
>> user must reimplement the RunnableInterface::breakLoop() function
>>
>> How do you do this?
>> Has anyone an example?
>>
>> thanx!
>>
>> nick
>>
>>
>> Use breakUpdateHook() instead. See example at
>>
>>
>> http://orocos.org/wiki/rtt/simple-examples/simple-tcp-client-using-non-b...
>>
>> HTH
>> S
>>
>>
>> Thank you Stephen and Klaas!
>> btw I read on the wiki:
>> "The breakUpdateHook() is very important, as it is the only way to inform a
>> blocked updateHook() that it is time to return and quit. In this example we
>> set the quit flag and return true. The quit flag will be picked up by
>> updateHook() when it finishes waiting for data (in
>> socket->waitForReadyRead()). Returning true from stopHook() tells the
>> execution engine that we successfully told updateHook() to return and that
>> it should wait (forever if need be) for updateHook() to complete and return.
>> If we returned false, then the system would attempt to terminate
>> updateHook() forcibly."
>>
>> I suppose it should be
>> ...Returning true from _breakUpdateHook()_ tells the execution engine .....
>> ?
>
> I think (but the example was kindly contributed by stephen).
> However, according to
> <http://svn.mech.kuleuven.be/websvn/orocos/branches/rtt/rtt-1.10/src/os/Thread.cpp>
>
> I think it should rather read something like
>
> Returning true from breakUpdateHook() tells the execution engine that
> we successfully told updateHook() to return and that
> it should wait (one second, hardcoded) for updateHook() to complete
> and return. If we returned false, then stop would also return false.
>
> Stephen, what do you think? (If it's correct, we can let Nick update
> the wiki ;-)

Yes, your description is better than mine. Please do update wiki, Nick.
S

stopping non-periodic activity

Forwarded from orocos-users...

On Thu, 17 Jun 2010, Klaas Gadeyne wrote:

> [...]
>> I'm implementing a non-periodic activity and when it stops, I would like it
>> to do it correctly :)
>> But he gives me an error:
>>
>> Got :Polaris.stop()
>> 17.919 [ Warning][Polaris] Failed to stop thread NonPeriodicActivity:
>> breakLoop() returned false.
>> = false
>> So it seems that he doesn't want to stop the updateHook()
>> In the manual there is something that says:
>> Since the activity may be blocked in the user's loop() function, the
>> user must reimplement the RunnableInterface::breakLoop() function
>>
>> How do you do this?
>> Has anyone an example?
>>
>> thanx!
>>
>> nick
>>
>>
>> Use breakUpdateHook() instead. See example at
>>
>>
>> http://orocos.org/wiki/rtt/simple-examples/simple-tcp-client-using-non-b...
>>
>> HTH
>> S
>>
>>
>> Thank you Stephen and Klaas!
>> btw I read on the wiki:
>> "The breakUpdateHook() is very important, as it is the only way to inform a
>> blocked updateHook() that it is time to return and quit. In this example we
>> set the quit flag and return true. The quit flag will be picked up by
>> updateHook() when it finishes waiting for data (in
>> socket->waitForReadyRead()). Returning true from stopHook() tells the
>> execution engine that we successfully told updateHook() to return and that
>> it should wait (forever if need be) for updateHook() to complete and return.
>> If we returned false, then the system would attempt to terminate
>> updateHook() forcibly."
>>
>> I suppose it should be
>> ...Returning true from _breakUpdateHook()_ tells the execution engine .....
>> ?
>
> I think (but the example was kindly contributed by stephen).
> However, according to
> <http://svn.mech.kuleuven.be/websvn/orocos/branches/rtt/rtt-1.10/src/os/Thread.cpp>
>
> I think it should rather read something like
>
> Returning true from breakUpdateHook() tells the execution engine that
> we successfully told updateHook() to return and that
> it should wait (one second, hardcoded)

"hardcoded"?!?!? Oops... Must be configurable, at least. Or rather, it
should become a "soft spot" in the framework.

> for updateHook() to complete
> and return. If we returned false, then stop would also return false.
>
> Stephen, what do you think? (If it's correct, we can let Nick update
> the wiki ;-)
>
> Klaas

Herman

stopping non-periodic activity

On Thursday 17 June 2010 10:54:49 Herman Bruyninckx wrote:
> Forwarded from orocos-users...
>
> On Thu, 17 Jun 2010, Klaas Gadeyne wrote:
> > [...]
> >
> >> I'm implementing a non-periodic activity and when it stops, I would like
> >> it to do it correctly :)
> >> But he gives me an error:
> >>
> >> Got :Polaris.stop()
> >> 17.919 [ Warning][Polaris] Failed to stop thread NonPeriodicActivity:
> >> breakLoop() returned false.
> >> = false
> >> So it seems that he doesn't want to stop the updateHook()
> >> In the manual there is something that says:
> >> Since the activity may be blocked in the user's loop() function, the
> >> user must reimplement the RunnableInterface::breakLoop() function
> >>
> >> How do you do this?
> >> Has anyone an example?
> >>
> >> thanx!
> >>
> >> nick
> >>
> >>
> >> Use breakUpdateHook() instead. See example at
> >>
> >>
> >> http://orocos.org/wiki/rtt/simple-examples/simple-tcp-client-using-non-b
> >>locking-component
> >>
> >> HTH
> >> S
> >>
> >>
> >> Thank you Stephen and Klaas!
> >> btw I read on the wiki:
> >> "The breakUpdateHook() is very important, as it is the only way to
> >> inform a blocked updateHook() that it is time to return and quit. In
> >> this example we set the quit flag and return true. The quit flag will be
> >> picked up by updateHook() when it finishes waiting for data (in
> >> socket->waitForReadyRead()). Returning true from stopHook() tells the
> >> execution engine that we successfully told updateHook() to return and
> >> that it should wait (forever if need be) for updateHook() to complete
> >> and return. If we returned false, then the system would attempt to
> >> terminate updateHook() forcibly."
> >>
> >> I suppose it should be
> >> ...Returning true from _breakUpdateHook()_ tells the execution engine
> >> ..... ?
> >
> > I think (but the example was kindly contributed by stephen).
> > However, according to
> > <http://svn.mech.kuleuven.be/websvn/orocos/branches/rtt/rtt-1.10/src/os/T
> >hread.cpp>
> >
> > I think it should rather read something like
> >
> > Returning true from breakUpdateHook() tells the execution engine that
> > we successfully told updateHook() to return and that
> > it should wait (one second, hardcoded)
>
> "hardcoded"?!?!? Oops... Must be configurable, at least. Or rather, it
> should become a "soft spot" in the framework.

It's a property of that Activity implementation which we discussed earlier on
this list. I think we all consider this as a bug, but there is currently no
API yet to set a timeout when calling stop(). It's an annoyance, any patch to
fix this is welcome of course. The current work around is to inherit from the
Activity object and implement your own stop() function, that uses a different
timeout value, or gets it from some place.

Peter

stopping non-periodic activity

On Jun 17, 2010, at 05:53 , Peter Soetens wrote:

> On Thursday 17 June 2010 10:54:49 Herman Bruyninckx wrote:
>> Forwarded from orocos-users...
>>
>> On Thu, 17 Jun 2010, Klaas Gadeyne wrote:
>>> [...]
>>>
>>>> I'm implementing a non-periodic activity and when it stops, I would like
>>>> it to do it correctly :)
>>>> But he gives me an error:
>>>>
>>>> Got :Polaris.stop()
>>>> 17.919 [ Warning][Polaris] Failed to stop thread NonPeriodicActivity:
>>>> breakLoop() returned false.
>>>> = false
>>>> So it seems that he doesn't want to stop the updateHook()
>>>> In the manual there is something that says:
>>>> Since the activity may be blocked in the user's loop() function, the
>>>> user must reimplement the RunnableInterface::breakLoop() function
>>>>
>>>> How do you do this?
>>>> Has anyone an example?
>>>>
>>>> thanx!
>>>>
>>>> nick
>>>>
>>>>
>>>> Use breakUpdateHook() instead. See example at
>>>>
>>>>
>>>> http://orocos.org/wiki/rtt/simple-examples/simple-tcp-client-using-non-b
>>>> locking-component
>>>>
>>>> HTH
>>>> S
>>>>
>>>>
>>>> Thank you Stephen and Klaas!
>>>> btw I read on the wiki:
>>>> "The breakUpdateHook() is very important, as it is the only way to
>>>> inform a blocked updateHook() that it is time to return and quit. In
>>>> this example we set the quit flag and return true. The quit flag will be
>>>> picked up by updateHook() when it finishes waiting for data (in
>>>> socket->waitForReadyRead()). Returning true from stopHook() tells the
>>>> execution engine that we successfully told updateHook() to return and
>>>> that it should wait (forever if need be) for updateHook() to complete
>>>> and return. If we returned false, then the system would attempt to
>>>> terminate updateHook() forcibly."
>>>>
>>>> I suppose it should be
>>>> ...Returning true from _breakUpdateHook()_ tells the execution engine
>>>> ..... ?
>>>
>>> I think (but the example was kindly contributed by stephen).
>>> However, according to
>>> <http://svn.mech.kuleuven.be/websvn/orocos/branches/rtt/rtt-1.10/src/os/T
>>> hread.cpp>
>>>
>>> I think it should rather read something like
>>>
>>> Returning true from breakUpdateHook() tells the execution engine that
>>> we successfully told updateHook() to return and that
>>> it should wait (one second, hardcoded)
>>
>> "hardcoded"?!?!? Oops... Must be configurable, at least. Or rather, it
>> should become a "soft spot" in the framework.
>
> It's a property of that Activity implementation which we discussed earlier on
> this list. I think we all consider this as a bug, but there is currently no
> API yet to set a timeout when calling stop(). It's an annoyance, any patch to
> fix this is welcome of course. The current work around is to inherit from the
> Activity object and implement your own stop() function, that uses a different
> timeout value, or gets it from some place.

There are other examples of such hard-coded values in the system. We have no set way to configure them - this has to be changed in time. A value like this could be exposed in the deployer, but that isn't scalable in the longrun.

As for inheriting from Activity, that then means you can't use it in a deployer. Which leads Herman down the path of "so can we configure the deployer's meta-runtime behaviour" ... ;-)

S

stopping non-periodic activity

On Thu, 17 Jun 2010, S Roderick wrote:

> On Jun 17, 2010, at 05:53 , Peter Soetens wrote:
>
>> On Thursday 17 June 2010 10:54:49 Herman Bruyninckx wrote:
>>> Forwarded from orocos-users...
>>>
>>> On Thu, 17 Jun 2010, Klaas Gadeyne wrote:
>>>> [...]
>>>>
>>>>> I'm implementing a non-periodic activity and when it stops, I would like
>>>>> it to do it correctly :)
>>>>> But he gives me an error:
>>>>>
>>>>> Got :Polaris.stop()
>>>>> 17.919 [ Warning][Polaris] Failed to stop thread NonPeriodicActivity:
>>>>> breakLoop() returned false.
>>>>> = false
>>>>> So it seems that he doesn't want to stop the updateHook()
>>>>> In the manual there is something that says:
>>>>> Since the activity may be blocked in the user's loop() function, the
>>>>> user must reimplement the RunnableInterface::breakLoop() function
>>>>>
>>>>> How do you do this?
>>>>> Has anyone an example?
>>>>>
>>>>> thanx!
>>>>>
>>>>> nick
>>>>>
>>>>>
>>>>> Use breakUpdateHook() instead. See example at
>>>>>
>>>>>
>>>>> http://orocos.org/wiki/rtt/simple-examples/simple-tcp-client-using-non-b
>>>>> locking-component
>>>>>
>>>>> HTH
>>>>> S
>>>>>
>>>>>
>>>>> Thank you Stephen and Klaas!
>>>>> btw I read on the wiki:
>>>>> "The breakUpdateHook() is very important, as it is the only way to
>>>>> inform a blocked updateHook() that it is time to return and quit. In
>>>>> this example we set the quit flag and return true. The quit flag will be
>>>>> picked up by updateHook() when it finishes waiting for data (in
>>>>> socket->waitForReadyRead()). Returning true from stopHook() tells the
>>>>> execution engine that we successfully told updateHook() to return and
>>>>> that it should wait (forever if need be) for updateHook() to complete
>>>>> and return. If we returned false, then the system would attempt to
>>>>> terminate updateHook() forcibly."
>>>>>
>>>>> I suppose it should be
>>>>> ...Returning true from _breakUpdateHook()_ tells the execution engine
>>>>> ..... ?
>>>>
>>>> I think (but the example was kindly contributed by stephen).
>>>> However, according to
>>>> <http://svn.mech.kuleuven.be/websvn/orocos/branches/rtt/rtt-1.10/src/os/T
>>>> hread.cpp>
>>>>
>>>> I think it should rather read something like
>>>>
>>>> Returning true from breakUpdateHook() tells the execution engine that
>>>> we successfully told updateHook() to return and that
>>>> it should wait (one second, hardcoded)
>>>
>>> "hardcoded"?!?!? Oops... Must be configurable, at least. Or rather, it
>>> should become a "soft spot" in the framework.
>>
>> It's a property of that Activity implementation which we discussed earlier on
>> this list. I think we all consider this as a bug, but there is currently no
>> API yet to set a timeout when calling stop(). It's an annoyance, any patch to
>> fix this is welcome of course. The current work around is to inherit from the
>> Activity object and implement your own stop() function, that uses a different
>> timeout value, or gets it from some place.
>
> There are other examples of such hard-coded values in the system. We have no set way to configure them - this has to be changed in time. A value like this could be exposed in the deployer, but that isn't scalable in the longrun.
>
> As for inheriting from Activity, that then means you can't use it in a deployer. Which leads Herman down the path of "so can we configure the deployer's meta-runtime behaviour" ... ;-)

Of course :-) But seriously, there _is_ a way out of this seemingly
infinite recursion to meta levels: "domain specific template
configurations". That is, a set of templates that contain lots of these
system-wide configuration variables and that (together!) make consistent
sense in a set of applications (= a "domain").

Herman