From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <518BAF44.9060803@xenomai.org> Date: Thu, 09 May 2013 16:14:28 +0200 From: Gilles Chanteperdrix MIME-Version: 1.0 References: <518A5F0C.50403@xenomai.org> <518ABA3D.5070106@xenomai.org> <518B8C50.2050107@xenomai.org> <518BA407.8020103@xenomai.org> In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [Xenomai] [Posix] I/O multiplexing with select List-Id: Discussions about the Xenomai project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: alex alex Cc: Xenomai 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.