javauis/javalegacyutils/src/eventserver/Open.cpp
changeset 76 4ad59aaee882
parent 69 773449708c84
child 79 2f468c1958d0
equal deleted inserted replaced
69:773449708c84 76:4ad59aaee882
     1 /*
       
     2 * Copyright (c) 1999-2001 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:
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <mevents.h>
       
    20 #include <j2me/jdebug.h>
       
    21 
       
    22 TBool CJavaEventSourceBase::Open()
       
    23 //
       
    24 // Add an extra reference to the object if it is not disposed
       
    25 // Return true if we have gained a good reference, false if
       
    26 // the object is awaiting destruction
       
    27 //
       
    28 {
       
    29     if (!IsDisposed())
       
    30     {
       
    31         // Another thread may call Dispose() between the test for
       
    32         // being disposed and the reference increment
       
    33         // Thus we must check to see if the reference count before
       
    34         // the increment was -1, in which case we must release the object
       
    35         if (User::LockedInc(iRef)>=0)
       
    36             return ETrue;
       
    37         User::LockedDec(iRef);
       
    38     }
       
    39     return EFalse;
       
    40 }
       
    41