[En-Nut-Discussion] Restart secific thread

Petr Odlozil zip357 at centrum.cz
Thu Nov 2 10:30:25 CET 2006


I was thinking how to restart a thread externally. For example when I 
detect that the thread hangs. I experienced some so far inexplicible 
hang of a thread on NutAccept()..
I am able to detect it by timer. The solution is to restart whole 
system, but other threads are running fine and there is someting in 
Memory I don't want to loose with complete restart.

I mean someting like NutThreadExit()

Best Regards

Petr

Lorenzo Lombardo napsal(a):
> Hi,
> if your thread reach the end, there's no way to restart it (as far as I 
> know). You can recreate it, but this will mess up a few things 
> considering that the resources of the previous thread are not freed.
> I use this code to lunch the thread every time I want:
> 
> First declare an handle:
> 
> HANDLE startExample;
> 
> Then here's the thread:
> 
> THREAD (example, arg)
> {
>    while(1)
>    {
>        // wait for the event to be posted
>        NutEventWait(&startExample, NUT_WAIT_INFINITE);
> 
>        <code>
> 
>    }
> }
> 
> When you want to lunch the thread, call:
> 
> NutEventPost(&startExample);
> 
> This work fine for me. If anyone have a better solution, he's welcome.
> 
> Regards,
>    Lorenzo
> 
> ----- Original Message ----- From: "Petr Odlozil" <zip357 at centrum.cz>
> To: <En-Nut-Discussion at egnite.de>
> Sent: Thursday, November 02, 2006 8:53 AM
> Subject: [En-Nut-Discussion] Restart secific thread
> 
> 
>> Hello,
>>
>> Is there a way how to restart specific thread in NutOs ?
>>
>> Best Regards
>>
>> Petr Odlozil
>> _______________________________________________
>> En-Nut-Discussion mailing list
>> En-Nut-Discussion at egnite.de
>> http://www.egnite.de/mailman/listinfo.cgi/en-nut-discussion
>>
>>
>>
>> -- 
>> No virus found in this incoming message.
>> Checked by AVG Free Edition.
>> Version: 7.1.409 / Virus Database: 268.13.22/512 - Release Date: 
>> 01/11/2006
>>
>>
> 
> _______________________________________________
> 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