VirtualBox

Changeset 102459 in vbox


Ignore:
Timestamp:
Dec 5, 2023 8:12:45 AM (12 months ago)
Author:
vboxsync
Message:

libs/xpcom: Convert the sole user of prclist.h to IPRT's RTList* API and remove it, bugref:10545

Location:
trunk/src/libs/xpcom18a4
Files:
1 deleted
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/libs/xpcom18a4/Makefile.kmk

    r102458 r102459  
    156156        nsprpub/lib/ds/plhash.h \
    157157        nsprpub/pr/include/prbit.h \
    158         nsprpub/pr/include/prclist.h \
    159158        nsprpub/pr/include/prinrval.h \
    160159        nsprpub/pr/include/prlong.h \
  • trunk/src/libs/xpcom18a4/nsprpub/pr/include/nspr.h

    r102392 r102459  
    4444
    4545#include "prbit.h"
    46 #include "prclist.h"
    4746#include "prinrval.h"
    4847#include "prlong.h"
  • trunk/src/libs/xpcom18a4/xpcom/threads/plevent.c

    r102392 r102459  
    7070struct PLEventQueue {
    7171    const char*         name;
    72     PRCList             queue;
     72    RTLISTANCHOR        queue;
    7373    PRMonitor*          monitor;
    7474    RTTHREAD            handlerThread;
     
    129129    self->notified = PR_FALSE;
    130130
    131     PR_INIT_CLIST(&self->queue);
     131    RTListInit(&self->queue);
    132132    if ( qtype == EventQueueIsNative ) {
    133133        err = _pl_SetupNativeNotifier(self);
     
    212212    /* insert event into thread's event queue: */
    213213    if (event != NULL) {
    214         PR_APPEND_LINK(&event->link, &self->queue);
     214        RTListAppend(&self->queue, &event->link);
    215215    }
    216216
     
    319319    PR_EnterMonitor(self->monitor);
    320320
    321     if (!PR_CLIST_IS_EMPTY(&self->queue)) {
     321    if (!RTListIsEmpty(&self->queue)) {
    322322        if ( self->type == EventQueueIsNative &&
    323323             self->notified                   &&
     
    332332
    333333        /* then grab the event and return it: */
    334         event = PR_EVENT_PTR(self->queue.next);
    335         PR_REMOVE_AND_INIT_LINK(&event->link);
     334        event = RTListGetFirst(&self->queue, PLEvent, link);
     335        RTListNodeRemove(&event->link);
     336        RTListInit(&event->link);
    336337    }
    337338
     
    351352    PR_EnterMonitor(self->monitor);
    352353
    353     if (!PR_CLIST_IS_EMPTY(&self->queue))
     354    if (!RTListIsEmpty(&self->queue))
    354355        result = PR_TRUE;
    355356
     
    361362PL_MapEvents(PLEventQueue* self, PLEventFunProc fun, void* data)
    362363{
    363     PRCList* qp;
    364 
    365364    if (self == NULL)
    366365        return;
    367366
    368367    PR_EnterMonitor(self->monitor);
    369     qp = self->queue.next;
    370     while (qp != &self->queue) {
    371         PLEvent* event = PR_EVENT_PTR(qp);
    372         qp = qp->next;
    373         (*fun)(event, data, self);
     368    PLEvent *pIt, *pItNext;
     369    RTListForEachSafe(&self->queue, pIt, pItNext, PLEvent, link)
     370    {
     371        (*fun)(pIt, data, self);
    374372    }
    375373    PR_ExitMonitor(self->monitor);
     
    422420#ifdef DEBUG
    423421    {
    424         PRCList* qp = self->queue.next;
    425         while (qp != &self->queue) {
    426             PLEvent* event = PR_EVENT_PTR(qp);
    427             qp = qp->next;
    428             Assert(event->owner != owner);
     422        PLEvent *pIt;
     423        RTListForEach(&self->queue, pIt, PLEvent, link)
     424        {
     425            Assert(pIt->owner != owner);
    429426        }
    430427    }
     
    439436_pl_GetEventCount(PLEventQueue* self)
    440437{
    441     PRCList* node;
    442438    PRInt32  count = 0;
    443439
    444440    PR_EnterMonitor(self->monitor);
    445     node = PR_LIST_HEAD(&self->queue);
    446     while (node != &self->queue) {
     441    PLEvent *pIt;
     442    RTListForEach(&self->queue, pIt, PLEvent, link)
     443    {
    447444        count++;
    448         node = PR_NEXT_LINK(node);
    449445    }
    450446    PR_ExitMonitor(self->monitor);
     
    518514             PLDestroyEventProc destructor)
    519515{
    520     PR_INIT_CLIST(&self->link);
     516    RTListInit(&self->link);
    521517    self->handler = handler;
    522518    self->destructor = destructor;
     
    544540
    545541    /* This event better not be on an event queue anymore. */
    546     Assert(PR_CLIST_IS_EMPTY(&self->link));
     542    Assert(RTListIsEmpty(&self->link));
    547543
    548544    result = self->handler(self);
     
    568564
    569565    /* This event better not be on an event queue anymore. */
    570     Assert(PR_CLIST_IS_EMPTY(&self->link));
     566    Assert(RTListIsEmpty(&self->link));
    571567
    572568    if(self->condVar != NIL_RTSEMEVENT)
     
    592588    PR_EnterMonitor(queue->monitor);
    593589
    594     Assert(!PR_CLIST_IS_EMPTY(&self->link));
     590    Assert(!RTListIsEmpty(&self->link));
    595591
    596592#if 0
     
    604600#endif
    605601
    606     PR_REMOVE_AND_INIT_LINK(&self->link);
     602    RTListNodeRemove(&self->link);
     603    RTListInit(&self->link);
    607604
    608605    PR_ExitMonitor(queue->monitor);
  • trunk/src/libs/xpcom18a4/xpcom/threads/plevent.h

    r102238 r102459  
    186186
    187187#include "prtypes.h"
    188 #include "prclist.h"
    189188#include "prmon.h"
    190189
    191190#include <iprt/critsect.h>
     191#include <iprt/list.h>
    192192#include <iprt/semaphore.h>
    193193#include <iprt/thread.h>
     
    522522
    523523struct PLEvent {
    524     PRCList                             link;
     524    RTLISTNODE                  link;
    525525    PLHandleEventProc   handler;
    526526    PLDestroyEventProc  destructor;
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