Page 1 of 1

OSDestroyTask()

PostPosted: Thu Feb 12, 2009 1:23 am
by peden
Hi,
I'm using Salvo Pro 4.2 for AVR with the IAR EWAVR 5 compiler.
When using OSDestroyTask() the compiler says ”too few arguments in function call”. The code structure is:
code:
#define Taskname OSTCBP(1)
OSDestroyTask( Taskname );


The below code piece is from the Salvo file “salvotask3.c”. It seems that OSDestroyTask() can have either one or two arguments, depending on if OSENABLE_EVENTS is defined or not.
In the User Manual only the first argument, OStypeTcbP tcbP, is mentioned. What is the purpose of the second argument, OStypeID events, and what should I write there?
BTW, I can’t seem to find any description of OSENABLE_EVENTS in the User Manual v4.1.2 for AVR, but perhaps it’s a definition internal to Salvo?
code:
#if OSENABLE_EVENTS
OStypeErr OSDestroyTask( OStypeTcbP tcbP, OStypeID events )
#else
OStypeErr OSDestroyTask( OStypeTcbP tcbP )
#endif


// peden

[This message has been edited by peden (edited February 12, 2009).]


Re: OSDestroyTask()

PostPosted: Thu Feb 12, 2009 2:37 am
by aek
Allways call it like this:
code:
OSDestroyTask( OSTASKS, OSEVENTS)

This assumes that you have some events defined.

OSENABLE_EVENTS is a meta-define used internally by Salvo.

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


Re: OSDestroyTask()

PostPosted: Thu Feb 12, 2009 3:06 am
by peden
Thanks for responding
However, I'm still not sure whats the purpose of second argument (events), and what should be written in this argument? Can you please give an example?
(strangely the second argument isn't shown in the manual, only the first argument)

OSDestroyTask( OSTCBP(1), ? );

Is it's purpose to destroy the events (ie. semaphores) used by the task?

// peden


Re: OSDestroyTask()

PostPosted: Thu Feb 12, 2009 4:06 am
by aek
The manual is not up-to-date.

The call must be made as shown, assuming your application has tasks and events.

If you're doing a build that does not have events (e.g. using a -d library), then you can call it as

code:
OSDestroyTask(OSTASKS)

.

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


Re: OSDestroyTask()

PostPosted: Thu Feb 12, 2009 4:29 am
by peden
I'm sorry to ask again, but could you explain what the second argument in OSDestroyTask is meant for?

I understand that the first argument should be the task pointer OSTCBP(x) of the task to be destroyed.
Should the second argument be the OSECBP(x) for some event used in the task to be destroyed.. or what is it's purpose?


Re: OSDestroyTask()

PostPosted: Thu Feb 12, 2009 5:11 am
by aek
Oh, sorry, my bad.

code:
OSDestroyTask(OSTCBP(n), OSEVENTS);

if events are used, and just
code:
OSDestroyTask(OSTCBP(n));

if not.

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