[En-Nut-Discussion] Run once threads ?
Ralph Mason
ralph.mason at telogis.com
Tue Jan 31 21:51:37 CET 2006
The compiler can't see that this function doesn't return.
You can get rid of the warning with
THREAD(MyFunc,arg) {
//DoStuff
NutThreadExit();
while(1);
}
Ralph
>
> 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
>
>
>
> _______________________________________________
> En-Nut-Discussion mailing list
> En-Nut-Discussion at egnite.de
> http://www.egnite.de/mailman/listinfo.cgi/en-nut-discussion
>
More information about the En-Nut-Discussion
mailing list