VirtualBox

Changeset 30933 in vbox for trunk/src/VBox/Runtime


Ignore:
Timestamp:
Jul 20, 2010 4:16:06 PM (14 years ago)
Author:
vboxsync
Message:

semevent-r0drv-solaris.c: review comments.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/r0drv/solaris/semevent-r0drv-solaris.c

    r30711 r30933  
    55
    66/*
    7  * Copyright (C) 2006-2007 Oracle Corporation
     7 * Copyright (C) 2006-2010 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    183183    }
    184184
     185    /*
     186     * If there are more waiting threads, wake them up. Otherwise leave the
     187     * semaphore in the signalled state.
     188     */
    185189    pThis->cWakeUp++;
    186     if (pThis->cWakeUp <= pThis->cWaiters)
    187     {
    188         /*
    189          * We decrement waiters here so that we don't keep signalling threads that
    190          * have already been signalled but not yet scheduled. So cWaiters might be
    191          * 0 even when there are threads actually waiting.
    192          */
     190    if (pThis->cWakeUp <= pThis->cWaiters) /** @todo r=bird: see cWakeup = 0 below. */
     191    {
    193192        cv_signal(&pThis->Cnd);
    194193        pThis->uSignalGen++;
     
    256255        Assert(!pThis->cWaiters);
    257256        pThis->fSignaled = false;
    258         pThis->cWakeUp = 0;
     257        /** @todo r=bird: This will get out of whack if someone is in the
     258         *        process of waking up (waiting to be scheduled). Further
     259         *        more, a race between a cv_signal and a
     260         *        timeout/interruption may cause wakeups to go unconsumed.
     261         *        Not sure how we could easily deal with this rigth now... */
     262        pThis->cWakeUp   = 0;
    259263        rc = VINF_SUCCESS;
    260264    }
     
    276280                    {
    277281                        /* We've been signaled by cv_signal(), consume the wake up. */
    278                         --pThis->cWakeUp;
     282                        --pThis->cWakeUp; /** @todo r=bird: May cause underflow, see above. */
    279283                        rc = VINF_SUCCESS;
    280284                    }
     
    294298                rc = VERR_INTERRUPTED;
    295299
    296             --pThis->cWaiters;
    297300            break;
    298301        }
     302        --pThis->cWaiters;
    299303    }
    300304
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette