Public bug reported:

Man page of pthread_kill:
...
  The pthread_kill function returns the following error codes on error:

              EINVAL signo is not a valid signal number
              ESRCH  the  thread  thread  does  not exist (e.g. it has already
                     terminated)

Compile and run the following program (errkill.c):

#include <pthread.h>
#include <stdio.h>
#include <string.h>

void* victim(void* data){
    return NULL;
}

main (){
    pthread_t th;
    int err;
    pthread_create(&th,NULL,victim,0);
    pthread_join(th,NULL);
    if (err = pthread_kill(th,0) != 0){
        printf("pthread_kill %s\n",strerror(err));
    }
}

$ gcc errkill.c -o errkill.exe -lpthread
$ ./errkill.exe
pthread_kill Operation not permitted

I.e. pthread_kill returns EPERM instead of ESRCH
Then, either the documentation or the library function is wrong.
I think that ESRCH is the correct error to report.

Ubuntu version: 9.04

** Affects: ubuntu
     Importance: Undecided
         Status: New

-- 
pthread_kill ESRCH
https://bugs.launchpad.net/bugs/374769
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to