[En-Nut-Discussion] Run once threads ?
Jesper Hansen
jesperh at telia.com
Wed Feb 1 14:58:55 CET 2006
Thanks Ralph,
That solves the actual warning, but the question is still whether
there may be other complications in running threads like this.
It does not seem so though, as it's been working fine for quite a while.
/Jesper
Ralph Mason wrote:
> 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
>>
>
> _______________________________________________
> 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