genericopenlibs/openenvcore/libpthread/src/pthread_cond_signal.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_cond_signal.cpp
       
    15 // Part of     : pthread
       
    16 // Interface   : POSIX, pthread
       
    17 // POSIX implementation of pthread on Symbian
       
    18 // Version     :
       
    19 //
       
    20 
       
    21 
       
    22 
       
    23 #include "condvartypes.h"
       
    24 
       
    25 /*
       
    26 This function restarts one of the threads that are waiting on the condition 
       
    27 variable cond. If no threads are waiting on cond, nothing happens. If several 
       
    28 threads are waiting on cond, exactly one is restarted. 
       
    29 */
       
    30 EXPORT_C int pthread_cond_signal(pthread_cond_t *cond)
       
    31 {
       
    32     if(!_staticCondInit(cond))
       
    33     {
       
    34         return EINVAL;
       
    35     }
       
    36     _CondNode* node = _QueueRemoveHead(&cond->iQueue);
       
    37     if(node)
       
    38     {
       
    39         sem_post(&node->iSemaphore);    
       
    40     }
       
    41     return 0;
       
    42 }
       
    43 
       
    44 
       
    45 //End of File
       
    46