|
1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // Name : pthread_attr_getschedparam.cpp |
|
15 // Part of : PThread library |
|
16 // pthread_attr_getschedparam call implementation. |
|
17 // Version: |
|
18 // |
|
19 |
|
20 |
|
21 |
|
22 #include <pthread.h> |
|
23 #include <errno.h> |
|
24 #include "threadglobals.h" |
|
25 #include "threadcreate.h" |
|
26 |
|
27 EXPORT_C int pthread_attr_getschedparam(const pthread_attr_t *attrib, |
|
28 struct sched_param *param) |
|
29 { |
|
30 THR_PRINTF("[pthread] Begin pthread_attr_getschedparam\n"); |
|
31 |
|
32 _pthread_attr *thAttrPtr; |
|
33 |
|
34 if ((NULL == attrib) || (NULL == param)) |
|
35 { |
|
36 THR_PRINTF("[pthread] End of pthread_attr_getschedparam\n"); |
|
37 return EINVAL; |
|
38 } |
|
39 |
|
40 thAttrPtr = (_pthread_attr*) attrib; |
|
41 |
|
42 if ((thAttrPtr->sp.sched_priority < MIN_RR_PRIORITY) || |
|
43 (thAttrPtr->sp.sched_priority > MAX_RR_PRIORITY)) |
|
44 { |
|
45 THR_PRINTF("[pthread] End of pthread_attr_getschedparam\n"); |
|
46 return EINVAL; |
|
47 } |
|
48 |
|
49 memcpy (param, &thAttrPtr->sp, sizeof (struct sched_param)); |
|
50 |
|
51 THR_PRINTF("[pthread] End pthread_attr_getschedparam\n"); |
|
52 |
|
53 return 0; |
|
54 } |
|
55 |
|
56 |
|
57 // End of File |