4,436
社区成员
发帖
与我相关
我的任务
分享
int
__pthread_attr_setschedpolicy (attr, policy)
pthread_attr_t *attr;
int policy;
{
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;
}
struct pthread_attr
{
/* Scheduler parameters and priority. */
struct sched_param schedparam;
int schedpolicy;
/* Various flags like detachstate, scope, etc. */
int flags;
/* Size of guard area. */
size_t guardsize;
/* Stack handling. */
void *stackaddr;
size_t stacksize;
/* Affinity map. */
cpu_set_t *cpuset;
size_t cpusetsize;
};