source: azure_iot_hub/trunk/musl-1.1.18/src/thread/pthread_attr_get.c@ 388

Last change on this file since 388 was 388, checked in by coas-nagasima, 5 years ago

Azure IoT Hub Device C SDK を使ったサンプルの追加

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
  • Property svn:mime-type set to text/x-csrc
File size: 2.2 KB
Line 
1#include "pthread_impl.h"
2
3int pthread_attr_getdetachstate(const pthread_attr_t *a, int *state)
4{
5 *state = a->_a_detach;
6 return 0;
7}
8int pthread_attr_getguardsize(const pthread_attr_t *restrict a, size_t *restrict size)
9{
10 *size = a->_a_guardsize;
11 return 0;
12}
13
14int pthread_attr_getinheritsched(const pthread_attr_t *restrict a, int *restrict inherit)
15{
16 *inherit = a->_a_sched;
17 return 0;
18}
19
20int pthread_attr_getschedparam(const pthread_attr_t *restrict a, struct sched_param *restrict param)
21{
22 param->sched_priority = a->_a_prio;
23 return 0;
24}
25
26int pthread_attr_getschedpolicy(const pthread_attr_t *restrict a, int *restrict policy)
27{
28 *policy = a->_a_policy;
29 return 0;
30}
31
32int pthread_attr_getscope(const pthread_attr_t *restrict a, int *restrict scope)
33{
34 *scope = PTHREAD_SCOPE_SYSTEM;
35 return 0;
36}
37
38int pthread_attr_getstack(const pthread_attr_t *restrict a, void **restrict addr, size_t *restrict size)
39{
40 if (!a->_a_stackaddr)
41 return EINVAL;
42 *size = a->_a_stacksize;
43 *addr = (void *)(a->_a_stackaddr - *size);
44 return 0;
45}
46
47int pthread_attr_getstacksize(const pthread_attr_t *restrict a, size_t *restrict size)
48{
49 *size = a->_a_stacksize;
50 return 0;
51}
52
53int pthread_barrierattr_getpshared(const pthread_barrierattr_t *restrict a, int *restrict pshared)
54{
55 *pshared = !!a->__attr;
56 return 0;
57}
58
59int pthread_condattr_getclock(const pthread_condattr_t *restrict a, clockid_t *restrict clk)
60{
61 *clk = a->__attr & 0x7fffffff;
62 return 0;
63}
64
65int pthread_condattr_getpshared(const pthread_condattr_t *restrict a, int *restrict pshared)
66{
67 *pshared = a->__attr>>31;
68 return 0;
69}
70
71int pthread_mutexattr_getprotocol(const pthread_mutexattr_t *restrict a, int *restrict protocol)
72{
73 *protocol = PTHREAD_PRIO_NONE;
74 return 0;
75}
76int pthread_mutexattr_getpshared(const pthread_mutexattr_t *restrict a, int *restrict pshared)
77{
78 *pshared = a->__attr / 128U % 2;
79 return 0;
80}
81
82int pthread_mutexattr_getrobust(const pthread_mutexattr_t *restrict a, int *restrict robust)
83{
84 *robust = a->__attr / 4U % 2;
85 return 0;
86}
87
88int pthread_mutexattr_gettype(const pthread_mutexattr_t *restrict a, int *restrict type)
89{
90 *type = a->__attr & 3;
91 return 0;
92}
93
94int pthread_rwlockattr_getpshared(const pthread_rwlockattr_t *restrict a, int *restrict pshared)
95{
96 *pshared = a->__attr[0];
97 return 0;
98}
Note: See TracBrowser for help on using the repository browser.