VirtualBox

Changeset 46185 in vbox for trunk/include/iprt


Ignore:
Timestamp:
May 21, 2013 6:28:49 AM (12 years ago)
Author:
vboxsync
Message:

Runtime: Rename RTWorkQueue to RTQueueAtomic

File:
1 moved

Legend:

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

    r45777 r46185  
    11/** @file
    2  * IPRT - Generic Work Queue with concurrent access.
     2 * IPRT - Generic Work Queue with concurrent atomic access.
    33 */
    44
     
    2424 */
    2525
    26 #ifndef ___iprt_workqueue_h
    27 #define ___iprt_workqueue_h
     26#ifndef ___iprt_queueatomic_h
     27#define ___iprt_queueatomic_h
    2828
    2929#include <iprt/types.h>
    3030#include <iprt/asm.h>
    3131
    32 /** @defgroup grp_rt_list    RTWorkQueue - Generic Work Queue
     32/** @defgroup grp_rt_list    RTQueueAtomic - Generic Work Queue
    3333 * @ingroup grp_rt
    3434 *
     
    4242 * A work item
    4343 */
    44 typedef struct RTWORKITEM
     44typedef struct RTQUEUEATOMICITEM
    4545{
    4646    /** Pointer to the next work item in the list. */
    47     struct RTWORKITEM * volatile pNext;
    48 } RTWORKITEM;
     47    struct RTQUEUEATOMICITEM * volatile pNext;
     48} RTQUEUEATOMICITEM;
    4949/** Pointer to a work item. */
    50 typedef RTWORKITEM *PRTWORKITEM;
     50typedef RTQUEUEATOMICITEM *PRTQUEUEATOMICITEM;
    5151/** Pointer to a work item pointer. */
    52 typedef PRTWORKITEM *PPRTWORKITEM;
     52typedef PRTQUEUEATOMICITEM *PPRTQUEUEATOMICITEM;
    5353
    5454/**
    5555 * Work queue.
    5656 */
    57 typedef struct RTWORKQUEUE
     57typedef struct RTQUEUEATOMIC
    5858{
    5959    /* Head of the work queue. */
    60     volatile PRTWORKITEM        pHead;
    61 } RTWORKQUEUE;
     60    volatile PRTQUEUEATOMICITEM        pHead;
     61} RTQUEUEATOMIC;
    6262/** Pointer to a work queue. */
    63 typedef RTWORKQUEUE *PRTWORKQUEUE;
     63typedef RTQUEUEATOMIC *PRTQUEUEATOMIC;
    6464
    6565/**
     
    6868 * @param   pWorkQueue          Pointer to an unitialised work queue.
    6969 */
    70 DECLINLINE(void) RTWorkQueueInit(PRTWORKQUEUE pWorkQueue)
     70DECLINLINE(void) RTQueueAtomicInit(PRTQUEUEATOMIC pWorkQueue)
    7171{
    7272    ASMAtomicWriteNullPtr(&pWorkQueue->pHead);
     
    7979 * @param   pItem               The item to insert.
    8080 */
    81 DECLINLINE(void) RTWorkQueueInsert(PRTWORKQUEUE pWorkQueue, PRTWORKITEM pItem)
     81DECLINLINE(void) RTQueueAtomicInsert(PRTQUEUEATOMIC pWorkQueue, PRTQUEUEATOMICITEM pItem)
    8282{
    83     PRTWORKITEM pNext = ASMAtomicUoReadPtrT(&pWorkQueue->pHead, PRTWORKITEM);
    84     PRTWORKITEM pHeadOld;
     83    PRTQUEUEATOMICITEM pNext = ASMAtomicUoReadPtrT(&pWorkQueue->pHead, PRTQUEUEATOMICITEM);
     84    PRTQUEUEATOMICITEM pHeadOld;
    8585    pItem->pNext = pNext;
    8686    while (!ASMAtomicCmpXchgExPtr(&pWorkQueue->pHead, pItem, pNext, &pHeadOld))
     
    9999 * @param   pWorkQueue          The work queue.
    100100 */
    101 DECLINLINE(PRTWORKITEM) RTWorkQueueRemoveAll(PRTWORKQUEUE pWorkQueue)
     101DECLINLINE(PRTQUEUEATOMICITEM) RTQueueAtomicRemoveAll(PRTQUEUEATOMIC pWorkQueue)
    102102{
    103     PRTWORKITEM pHead = ASMAtomicXchgPtrT(&pWorkQueue->pHead, NULL, PRTWORKITEM);
     103    PRTQUEUEATOMICITEM pHead = ASMAtomicXchgPtrT(&pWorkQueue->pHead, NULL, PRTQUEUEATOMICITEM);
    104104
    105105    /* Reverse it. */
    106     PRTWORKITEM pCur = pHead;
     106    PRTQUEUEATOMICITEM pCur = pHead;
    107107    pHead = NULL;
    108108    while (pCur)
    109109    {
    110         PRTWORKITEM pInsert = pCur;
     110        PRTQUEUEATOMICITEM pInsert = pCur;
    111111        pCur = pCur->pNext;
    112112        pInsert->pNext = pHead;
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