Pumpkin, Inc.

Pumpkin User Forums

OSDestroyTask()

If you can't make Salvo do what you want it to do, post it here.

OSDestroyTask()

Postby peden » Thu Feb 12, 2009 1:23 am

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).]

peden
 
Posts: 7
Joined: Fri Jan 30, 2009 12:00 am
Location: Denmark

Re: OSDestroyTask()

Postby aek » Thu Feb 12, 2009 2:37 am

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.

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

-------
aek
aek
 
Posts: 1888
Joined: Sat Aug 26, 2000 11:00 pm

Re: OSDestroyTask()

Postby peden » Thu Feb 12, 2009 3:06 am

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

peden
 
Posts: 7
Joined: Fri Jan 30, 2009 12:00 am
Location: Denmark

Re: OSDestroyTask()

Postby aek » Thu Feb 12, 2009 4:06 am

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)

.

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

-------
aek
aek
 
Posts: 1888
Joined: Sat Aug 26, 2000 11:00 pm

Re: OSDestroyTask()

Postby peden » Thu Feb 12, 2009 4:29 am

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?

peden
 
Posts: 7
Joined: Fri Jan 30, 2009 12:00 am
Location: Denmark

Re: OSDestroyTask()

Postby aek » Thu Feb 12, 2009 5:11 am

Oh, sorry, my bad.

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

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

if not.

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

-------
aek
aek
 
Posts: 1888
Joined: Sat Aug 26, 2000 11:00 pm


Return to Coding

Who is online

Users browsing this forum: No registered users and 3 guests