Page 1 of 1

docu-bug: OSSetTS() bug in the example

PostPosted: Thu Jan 08, 2004 3:45 am
by lattenzaun
Hello AEK.

I usually do not report docu-bugs, but this one bothers me:

In the example of OSSetTS() on page 353 you are changing the task's timestamp to a variable which is volatile:

code:

void Task(void)
{
OStypeTS timestamp;
...
timestamp = OSGetTS();
OS_Delay(1, label2);
OSSetTS(timestamp);
...
}


This example cannot work, because all OS_xxx() calls will lose volatile stack-variables. You must define "timestamp" as static:
code:

void Task(void)
{
static OStypeTS timestamp;
...
}


Otherwhise you could set "timestamp" to a random value.

BTW, I played a little bit with OSGetTS(), but I never got a return-value <> 0. ...

Regards,
Martin


Re: docu-bug: OSSetTS() bug in the example

PostPosted: Thu Jan 08, 2004 4:14 am
by aek
Hi Martin.

I guess the bitter winter cold in Vienna finds you reading the Salvo User Manual ...

You are of course correct about the need for static in that example.

I'll check on OSGetTS()'s return value ... the run-time "persistence" of the TS is a little tricky ... I may have to document that function better.

------------------