* Added pthread_attr_setscope(), and pthread_attr_getscope(). We only support
PTHREAD_SCOPE_SYSTEM which makes the implementation rather simple. * This closed ticket #2242. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25628 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
74be35c78b
commit
a411c76cd6
@ -224,6 +224,9 @@ extern int pthread_attr_setdetachstate(pthread_attr_t *attr, int detachstate);
|
||||
extern int pthread_attr_getstacksize(const pthread_attr_t *attr,
|
||||
size_t *stacksize);
|
||||
extern int pthread_attr_setstacksize(pthread_attr_t *attr, size_t stacksize);
|
||||
extern int pthread_attr_getscope(const pthread_attr_t *attr,
|
||||
int *contentionScope);
|
||||
extern int pthread_attr_setscope(pthread_attr_t *attr, int contentionScope);
|
||||
|
||||
#if 0 /* Unimplemented attribute functions: */
|
||||
|
||||
@ -241,9 +244,6 @@ extern int pthread_attr_setinheritsched(pthread_attr_t *attr, int inheritsched);
|
||||
extern int pthread_attr_getschedpolicy(const pthread_attr_t *attr,
|
||||
int *policy);
|
||||
extern int pthread_attr_setschedpolicy(pthread_attr_t *attr, int policy);
|
||||
extern int pthread_attr_getscope(const pthread_attr_t *attr,
|
||||
int *contentionscope);
|
||||
extern int pthread_attr_setscope(pthread_attr_t *attr, int contentionscope);
|
||||
|
||||
/* [XSI] */
|
||||
extern int pthread_attr_getguardsize(const pthread_attr_t *attr,
|
||||
|
@ -1,5 +1,6 @@
|
||||
/*
|
||||
/*
|
||||
* Copyright 2008, Ingo Weinhold, ingo_weinhold@gmx.de.
|
||||
* Copyright 2008, Axel Dörfler, axeld@pinc-software.de.
|
||||
* Copyright 2006, Jérôme Duval. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
@ -12,7 +13,7 @@
|
||||
#include <thread_defs.h>
|
||||
|
||||
|
||||
int
|
||||
int
|
||||
pthread_attr_init(pthread_attr_t *_attr)
|
||||
{
|
||||
pthread_attr *attr;
|
||||
@ -33,7 +34,7 @@ pthread_attr_init(pthread_attr_t *_attr)
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
int
|
||||
pthread_attr_destroy(pthread_attr_t *_attr)
|
||||
{
|
||||
pthread_attr *attr;
|
||||
@ -52,7 +53,7 @@ int
|
||||
pthread_attr_getdetachstate(const pthread_attr_t *_attr, int *state)
|
||||
{
|
||||
pthread_attr *attr;
|
||||
|
||||
|
||||
if (_attr == NULL || (attr = *_attr) == NULL || state == NULL)
|
||||
return B_BAD_VALUE;
|
||||
|
||||
@ -108,3 +109,27 @@ pthread_attr_setstacksize(pthread_attr_t *_attr, size_t stacksize)
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
pthread_attr_getscope(const pthread_attr_t *attr, int *contentionScope)
|
||||
{
|
||||
if (attr == NULL || contentionScope == NULL)
|
||||
return EINVAL;
|
||||
|
||||
*contentionScope = PTHREAD_SCOPE_SYSTEM;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
pthread_attr_setscope(pthread_attr_t *attr, int contentionScope)
|
||||
{
|
||||
if (attr == NULL)
|
||||
return EINVAL;
|
||||
|
||||
if (contentionScope != PTHREAD_SCOPE_SYSTEM)
|
||||
return ENOTSUP;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user