[En-Nut-Discussion] Run once threads ?

Jesper Hansen jesperh at telia.com
Tue Jan 31 16:46:14 CET 2006


In my application I sometimes need to fade in or fade out the volume of 
a MP3 playback.

I tried making these two functions for it :

THREAD(FadeIn,arg)
{
   while (g_vol > 12)
   {
     vs1011_setvolume(g_vol,g_vol);
     g_vol--;
     NutSleep(10);
   }
   NutThreadExit();
}

THREAD(FadeOut,arg)
{
   while (g_vol < 250)
   {
     vs1011_setvolume(g_vol,g_vol);
     g_vol++;
     NutSleep(10);
   }
   NutThreadExit();
}

The fade is then activated by simply creating the appropriate thread, 
which will run and then terminate itself when done.
The thread memory will be released in the Idle task.

This seems to work fine, and I have no memory leaks, BUT the compiler 
complains about the THREAD functions, with a warning:
warning: `noreturn' function does return

Should I worry about this, or is it safe to run threads like this ?

/Jesper






More information about the En-Nut-Discussion mailing list