NAME
pthread_getname_np
,
pthread_setname_np
—
get and set descriptive name of a
thread
LIBRARY
library “libpthread”
SYNOPSIS
#include
<pthread.h>
int
pthread_getname_np
(pthread_t
thread, char *name,
size_t len);
int
pthread_setname_np
(pthread_t
thread, const char
*name, void
*arg);
DESCRIPTION
Thepthread_getname_np
()
function obtains the descriptive name of a thread. It takes the following
arguments:
- thread
- The thread whose descriptive name will be obtained.
- name
- The buffer to be filled with the descriptive name of the thread.
- len
- The size of the buffer name in bytes.
The
pthread_setname_np
()
function sets the descriptive name of a thread. It takes the following
arguments:
RETURN VALUES
Both functions return 0 on success. Otherwise, an error number is returned to indicate the error.
COMPATIBILITY
Both functions are non-standard extensions.
ERRORS
Both functions may fail if:
- [
EINVAL
] - Invalid parameter.
- [
ESRCH
] - Non-existent thread.
The pthread_setname_np
() function may also
fail if:
- [
ENOMEM
] - There was insufficient memory for the operation.