On 05/09/2013 04:09 PM, alex alex wrote:

> I you call pthread_set_name_np for a thread that may not exist, this is
> 
>> an issue which has already been fixed:
>>
>>
> I have tried to used pthread_set_name_np with a thread that may not exist
> but it correctly returns ESRCH.
> 
> I've also tried to reproduce this bug by creating and canceling a thread in
> a loop, but I can not have this bug anymore.


Ok, are you sure that the string you passed to pthread_set_name_np could
not have been overwritten in the mean time? For instance by passing to
the thread an argument which resides on the caller stack. Like for instance:

void *thread(void *cookie)
{
        pthread_set_name_np(pthread_self(), (char *)cookie);
        
        /* ... */
}

void create_thread(void)
{
        char name[]= "name";
        pthread_t tid;

        pthread_create(&tid, NULL, thread, name);
}

int main(void)
{
        create_thread();

        /* ... */

}

-- 
                                                                Gilles.

_______________________________________________
Xenomai mailing list
[email protected]
http://www.xenomai.org/mailman/listinfo/xenomai

Reply via email to