View unanswered posts | View active topics It is currently Sun Nov 23, 2014 4:40 am






Reply to topic  [ 2 posts ] 
Question about AutoStarting Tasks 
Author Message
Novice

Joined: Fri Oct 24, 2008 8:58 am
Posts: 87
Post Question about AutoStarting Tasks
I have a need to *not* autostart a task. But I can't seem to get it to work.
I figured it was dependent on whether "#pragma autoStartTasks" was defined at the top of the C file, but ALL of my tasks in the entire application seem to start at the beginning.

I even tried removing all the other "autostart" definintions and manually starting the joystick driver, etc at the beginning of my code.

The only solution that has worked is putting a 100msec delay at the beginning of my custom task and stopping it right away at the beginning of main(). I'd like to get rid of this hack though.

Am I missing something here? Can I specify autostart on a task-by-task basis or is it program wide? How do I turn OFF autostart?


Mon Jan 26, 2009 1:57 pm
Profile
Novice

Joined: Fri Oct 24, 2008 8:58 am
Posts: 87
Post Re: Question about AutoStarting Tasks
Wow, this topic really sparked alot of interest. :)

Okay since nobody bit on this I did a little more investigation and after a million recompiles I managed to get a small sample code that demonstrates the problem. And should provide the developers enough insight to find the problem pretty easily...fixing it might be easy or hard depending on where the bug actually is.

Basically, the problem is that once a macro() is invoked by the preprocessor, the #pragma autoStartTasks is locked in for all sources in the project. Yes it really is that insane (which is why it took me a while to figure out). Here's a test/proof.

File #1: test.c
Code:
#include "testfoo.c"

task dontStartMeTask() {}

task main()
{
  while (true);
}


File #2: testfoo.c
Code:

#pragma autoStartTasks
#define anyMacroHere(x, y) x = y

task autoStartMeTask()
{
}

void fooFunc()
{
   int a, b;
   anyMacroHere(a,b);
}


And for those who don't want to bother typing this code in, here's the interesting part of the results...
Quote:
task main()
//
//Code segment: main(); Task: 0
//
0000: XX180000000000000000 defineMUXes(none, none, none, none, none, none, none, none, none, none, none, none, none, none, none, none)
: 0000000000000000
0012: XX01 StartTask(autoStartMeTask)
0014: XX02 StartTask(dontStartMeTask)
{
while (true);
0016: XX81 L0016: BranchNear(L0016) // Jump to end Expression
*Warning*:Possible programming error. Infinite loop (unconditional branch to itself) detected.
}


That line in red should definitely not be there, and in fact if you comment out the macro call it will go away.

If this was open source I'd post a patch instead complaining, but since its not... this is as close to a solution as I can give you.
Happy bug stomping.


Mon Feb 02, 2009 9:27 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 2 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron



Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.