Back to index

glibc  2.9
Functions
pthread_attr_setinheritsched.c File Reference
#include <assert.h>
#include <errno.h>
#include "pthreadP.h"

Go to the source code of this file.

Functions

int __pthread_attr_setinheritsched (pthread_attr_t *attr, int inherit)

Function Documentation

Definition at line 26 of file pthread_attr_setinheritsched.c.

{
  struct pthread_attr *iattr;

  assert (sizeof (*attr) >= sizeof (struct pthread_attr));
  iattr = (struct pthread_attr *) attr;

  /* Catch invalid values.  */
  if (inherit != PTHREAD_INHERIT_SCHED && inherit != PTHREAD_EXPLICIT_SCHED)
    return EINVAL;

  /* Store the new values.  */
  if (inherit != PTHREAD_INHERIT_SCHED)
    iattr->flags |= ATTR_FLAG_NOTINHERITSCHED;
  else
    iattr->flags &= ~ATTR_FLAG_NOTINHERITSCHED;

  return 0;
}