Logo Search packages:      
Sourcecode: virtualbox-ose version File versions

void VirtualBoxBaseProto::releaseCaller (  )  [virtual, inherited]

Decreases the number of calls to this object by one.

Must be called after every addCaller() or addLimitedCaller() when protecting the object from uninitialization is no more necessary.

Definition at line 246 of file VirtualBoxBase.cpp.

References AssertMsgFailed, AssertMsgReturn, VirtualBoxBaseProto::mCallers, VirtualBoxBaseProto::mState, VirtualBoxBaseProto::mStateChangeThread, VirtualBoxBaseProto::mStateLock, and VirtualBoxBaseProto::mZeroCallersSem.

{
    AutoWriteLock stateLock (mStateLock);

    if (mState == Ready || mState == Limited)
    {
        /* if Ready or Limited, decrease the number of callers */
        AssertMsgReturn (mCallers != 0, ("mCallers is ZERO!"), (void) 0);
        -- mCallers;

        return;
    }

    if (mState == InInit || mState == MayUninit || mState == InUninit)
    {
        if (mStateChangeThread == RTThreadSelf())
        {
            /* Called from the same thread that is doing AutoInitSpan,
             * AutoMayUninitSpan or AutoUninitSpan: just succeed */
            return;
        }

        if (mState == MayUninit || mState == InUninit)
        {
            /* the caller is being released after AutoUninitSpan or
             * AutoMayUninitSpan has begun */
            AssertMsgReturn (mCallers != 0, ("mCallers is ZERO!"), (void) 0);
            -- mCallers;

            if (mCallers == 0)
            {
                /* inform the Auto*UninitSpan ctor there are no more callers */
                RTSemEventSignal (mZeroCallersSem);
            }

            return;
        }
    }

    AssertMsgFailed (("mState = %d!", mState));
}


Generated by  Doxygen 1.6.0   Back to index