genericopenlibs/openenvcore/libpthread/src/pthread_self.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_self.cpp
       
    15 // Part of  : PThread library
       
    16 // pthread_self call is implemented.
       
    17 // Version:
       
    18 //
       
    19 
       
    20 
       
    21 
       
    22 #include <pthread.h>
       
    23 #include "threadglobals.h"
       
    24 #include "threadcreate.h"
       
    25 #include "pthreadmisc.h"
       
    26 
       
    27 
       
    28 EXPORT_C pthread_t pthread_self()
       
    29 {
       
    30     THR_PRINTF("[pthread] Begin pthread_self\n");
       
    31     
       
    32     //Get the TLS value (self node pointer)
       
    33     TAny *tlsAddr = (_pthread_node_t*) _pthread_getTls();
       
    34     
       
    35     THR_PRINTF("[pthread] End pthread_self\n");
       
    36     
       
    37     return ((pthread_t) tlsAddr);
       
    38 }
       
    39 // End of File