Lines Matching refs:attr

41 int pthread_attr_init(pthread_attr_t* attr) {
42 attr->flags = 0;
43 attr->stack_base = NULL;
44 attr->stack_size = PTHREAD_STACK_SIZE_DEFAULT;
45 attr->guard_size = PAGE_SIZE;
46 attr->sched_policy = SCHED_NORMAL;
47 attr->sched_priority = 0;
51 int pthread_attr_destroy(pthread_attr_t* attr) {
52 memset(attr, 0x42, sizeof(pthread_attr_t));
56 int pthread_attr_setdetachstate(pthread_attr_t* attr, int state) {
58 attr->flags |= PTHREAD_ATTR_FLAG_DETACHED;
60 attr->flags &= ~PTHREAD_ATTR_FLAG_DETACHED;
67 int pthread_attr_getdetachstate(const pthread_attr_t* attr, int* state) {
68 *state = (attr->flags & PTHREAD_ATTR_FLAG_DETACHED) ? PTHREAD_CREATE_DETACHED : PTHREAD_CREATE_JOINABLE;
72 int pthread_attr_setschedpolicy(pthread_attr_t* attr, int policy) {
73 attr->sched_policy = policy;
77 int pthread_attr_getschedpolicy(const pthread_attr_t* attr, int* policy) {
78 *policy = attr->sched_policy;
82 int pthread_attr_setschedparam(pthread_attr_t* attr, const sched_param* param) {
83 attr->sched_priority = param->sched_priority;
87 int pthread_attr_getschedparam(const pthread_attr_t* attr, sched_param* param) {
88 param->sched_priority = attr->sched_priority;
92 int pthread_attr_setstacksize(pthread_attr_t* attr, size_t stack_size) {
96 attr->stack_size = stack_size;
100 int pthread_attr_getstacksize(const pthread_attr_t* attr, size_t* stack_size) {
102 return pthread_attr_getstack(attr, &unused, stack_size);
105 int pthread_attr_setstack(pthread_attr_t* attr, void* stack_base, size_t stack_size) {
112 attr->stack_base = stack_base;
113 attr->stack_size = stack_size;
183 int pthread_attr_getstack(const pthread_attr_t* attr, void** stack_base, size_t* stack_size) {
184 *stack_base = attr->stack_base;
185 *stack_size = attr->stack_size;
189 int pthread_attr_setguardsize(pthread_attr_t* attr, size_t guard_size) {
190 attr->guard_size = guard_size;
194 int pthread_attr_getguardsize(const pthread_attr_t* attr, size_t* guard_size) {
195 *guard_size = attr->guard_size;
199 int pthread_getattr_np(pthread_t t, pthread_attr_t* attr) {
201 *attr = thread->attr;
202 // We prefer reading join_state here to setting thread->attr.flags in pthread_detach.
205 attr->flags |= PTHREAD_ATTR_FLAG_DETACHED;
207 // The main thread's stack information is not stored in thread->attr, and we need to
210 return __pthread_attr_getstack_main_thread(&attr->stack_base, &attr->stack_size);