I think you should remove pthread_kill because man reports only one possible error:
```
ESRCH  No thread with the ID thread could be found.
```