VirtualBox

Changeset 19896 in vbox


Ignore:
Timestamp:
May 21, 2009 9:35:42 PM (16 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
47591
Message:

IPRT: Added a RTOnceReset method (needed it for a testcase).

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/once.h

    r10940 r19896  
    9292RTDECL(int) RTOnce(PRTONCE pOnce, PFNRTONCE pfnOnce, void *pvUser1, void *pvUser2);
    9393
     94/**
     95 * Resets an execute once variable.
     96 *
     97 * The caller is responsible for making sure there are no concurrent accesses to
     98 * the execute once variable.
     99 *
     100 * @param   pOnce           Pointer to the execute once variable.
     101 */
     102RTDECL(void) RTOnceReset(PRTONCE pOnce);
     103
    94104/** @} */
    95105
  • trunk/src/VBox/Runtime/common/misc/once.cpp

    r10940 r19896  
    160160}
    161161
     162
     163RTDECL(void) RTOnceReset(PRTONCE pOnce)
     164{
     165    /* Cannot be done while busy! */
     166    AssertPtr(pOnce);
     167    Assert(pOnce->hEventMulti == NIL_RTSEMEVENTMULTI);
     168    Assert(pOnce->iState != 1);
     169
     170    /* Do the same as RTONCE_INITIALIZER does. */
     171    ASMAtomicWriteS32(&pOnce->rc, VERR_INTERNAL_ERROR);
     172    ASMAtomicWriteS32(&pOnce->iState, -1);
     173}
     174
Note: See TracChangeset for help on using the changeset viewer.

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