Appendix C. Pthreads Quick Reference

In this appendix, we’ll provide a brief listing of the C language bindings of the Pthreads library routines:

pthread_atfork( )
int pthread_atfork (
void (*prepare)(void),
void (*parent)(void),
void (*child)(void));

Declares procedures to be called before and after a fork call. The prepare fork handler runs in the parent process before the fork. After the fork, the parent handler runs in the parent process, and the child handler runs in the child process.

pthread_attr_destroy( )
int pthread_attr_destroy (
pthread_attr_t *attr);

Destroys a thread attribute object.

pthread_attr_getdetachstate( )
int pthread_attr_getdetachstate (
const pthread_attr_t *attr,
int *detachstate);

Obtains the setting of the detached state of a thread.

pthread_attr_getinheritsched( )
int pthread_attr_getinheritsched (
const pthread_attr_t *attr,
int *inheritsched);

Obtains the setting of the scheduling inheritance of a thread.

pthread_attr_getschedparam( )
int pthread_attr_getschedparam (
const pthread_attr_t *attr,
struct sched_param *param);

Obtains the parameters (for instance, the scheduling priority) associated with the scheduling policy attribute of a thread.

pthread_attr_getschedpolicy( )
int pthread_attr_getschedpolicy (
const pthread_attr_t *attr,
int *policy);

Obtains the setting of the scheduling policy of a thread.

pthread_attr_getscope( )
int pthread_attr_getscope (
const pthread_attr_t *attr,
int *scope);

Obtains the setting of the scheduling scope of a thread.

pthread_attr_getstackaddr( ...

Get PThreads Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.