javauis/m2g_qt/inc/CSynchronization.h
changeset 80 d6dafc5d983f
parent 56 abc41079b313
child 87 1627c337e51e
equal deleted inserted replaced
78:71ad690e91f5 80:d6dafc5d983f
       
     1 /*
       
     2 * Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  M3GCore function call serialization and synchronization
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef CSYNCHRONIZATION_H
       
    19 #define CSYNCHRONIZATION_H
       
    20 
       
    21 // INCLUDE FILES
       
    22 #include <e32std.h>
       
    23 #include <e32base.h>
       
    24 
       
    25 // CLASS DECLARATION
       
    26 /**
       
    27  * @class CSynchronization
       
    28  */
       
    29 class CSynchronization : public CBase
       
    30 {
       
    31 public:
       
    32     /**
       
    33      * Two-phased constructor.
       
    34          */
       
    35     static CSynchronization* InstanceL();
       
    36 
       
    37     /**
       
    38          * Dtor
       
    39          */
       
    40     ~CSynchronization();
       
    41 
       
    42     /**
       
    43        * Locks the semaphore
       
    44        */
       
    45     void Lock();
       
    46 
       
    47     /**
       
    48        * Unlocks the semaphore
       
    49        */
       
    50     void Unlock();
       
    51 
       
    52     /**
       
    53     * Sets error code for error occured during lock period
       
    54     */
       
    55     void SetErrorCode(TInt aCode);
       
    56 
       
    57     /**
       
    58     * Returns error string set with SetErrorString
       
    59     */
       
    60     TInt GetErrorCode();
       
    61 
       
    62 private: // METHODS
       
    63     /**
       
    64       * Constructor
       
    65       */
       
    66     CSynchronization();
       
    67 
       
    68     /**
       
    69     * Two-phased constructor.
       
    70     * @return New object
       
    71     */
       
    72     static CSynchronization* NewL();
       
    73 
       
    74     /**
       
    75      * Constructor
       
    76      */
       
    77     void ConstructL();
       
    78 
       
    79 private: // MEMBER VARIABLES
       
    80     static CSynchronization* iSelf;
       
    81     RCriticalSection iGuard;
       
    82     TInt iErrorCode;
       
    83 };
       
    84 
       
    85 #endif // CSYNCHRONIZATION_H