genericopenlibs/openenvcore/libpthread/src/pthread_attr_init.cpp
changeset 0 e4d67989cc36
equal deleted inserted replaced
-1:000000000000 0:e4d67989cc36
       
     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_init.cpp
       
    15 // Part of  : PThread library
       
    16 // pthread_attr_init 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_init(pthread_attr_t *attrib)
       
    28 {
       
    29     THR_PRINTF("[pthread] Begin pthread_attr_init\n");
       
    30 
       
    31     _pthread_attr *thAttrPtr;
       
    32     
       
    33     if (NULL == attrib)
       
    34     {
       
    35         THR_PRINTF("[pthread] End of pthread_attr_init\n");
       
    36         return EINVAL;
       
    37     }
       
    38     
       
    39     thAttrPtr = (_pthread_attr*) attrib;
       
    40     
       
    41     thAttrPtr->stackSize = DEFAULT_STACK_SIZE;
       
    42     thAttrPtr->detachState = PTHREAD_CREATE_JOINABLE;
       
    43     thAttrPtr->scope = PTHREAD_SCOPE_SYSTEM;
       
    44     thAttrPtr->policy = SCHED_RR;
       
    45     thAttrPtr->sp.sched_priority = 100; /* this leads to EPriorityNormal */
       
    46     thAttrPtr->priority = EPriorityNormal;
       
    47     
       
    48     THR_PRINTF("[pthread] End pthread_attr_init\n");
       
    49     
       
    50     return 0;
       
    51 }
       
    52 
       
    53 // End of File