Back to index

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

Go to the source code of this file.

Functions

int __pthread_attr_setschedpolicy (pthread_attr_t *attr, int policy)

Function Documentation

Definition at line 26 of file pthread_attr_setschedpolicy.c.

{
  struct pthread_attr *iattr;

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

  /* Catch invalid values.  */
  if (policy != SCHED_OTHER && policy != SCHED_FIFO && policy != SCHED_RR)
    return EINVAL;

  /* Store the new values.  */
  iattr->schedpolicy = policy;

  /* Remember we set the value.  */
  iattr->flags |= ATTR_FLAG_POLICY_SET;

  return 0;
}