sl@0: // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // Name : mutexgeneric.cpp sl@0: // Part of : PThread library sl@0: // APIs needed for implementing pthread mutex APIs sl@0: // are implemented. sl@0: // Version : sl@0: // sl@0: sl@0: sl@0: sl@0: #include "threadglobals.h" sl@0: #include "threadcreate.h" sl@0: sl@0: int _pthread_atomicMutexLock(void *tlsPtr) sl@0: { sl@0: _pthread_node_t *selfNodePtr; sl@0: _global_data_t *glbPtr; sl@0: sl@0: THR_PRINTF("[pthread] Begin _pthread_atomicMutexLock\n"); sl@0: if (NULL == tlsPtr) sl@0: { sl@0: THR_PRINTF("[pthread] FATAL: TLS is NULL\n"); sl@0: return -1; sl@0: } sl@0: sl@0: selfNodePtr = (_pthread_node_t *)tlsPtr; sl@0: sl@0: // Global data strcuture Pointer sl@0: glbPtr = selfNodePtr->glbDataPtr; sl@0: sl@0: glbPtr->globalLockForMutex.Wait(); sl@0: THR_PRINTF("[pthread] End _pthread_atomicMutexLock\n"); sl@0: return 0; sl@0: } sl@0: sl@0: int _pthread_atomicMutexUnlock(void *tlsPtr) sl@0: { sl@0: _pthread_node_t *selfNodePtr; sl@0: _global_data_t *glbPtr; sl@0: sl@0: THR_PRINTF("[pthread] Begin _pthread_atomicMutexUnlock\n"); sl@0: if (NULL == tlsPtr) sl@0: { sl@0: THR_PRINTF("[pthread] FATAL: TLS is NULL\n"); sl@0: return -1; sl@0: } sl@0: sl@0: selfNodePtr = (_pthread_node_t *)tlsPtr; sl@0: sl@0: // Global data strcuture Pointer sl@0: glbPtr = selfNodePtr->glbDataPtr; sl@0: sl@0: glbPtr->globalLockForMutex.Signal(); sl@0: sl@0: THR_PRINTF("[pthread] End _pthread_atomicMutexUnlock\n"); sl@0: return 0; sl@0: } sl@0: sl@0: // End of file