Exemple #1
0
HRESULT ListenerRecord::process(IEvent*                     aEvent,
                                BOOL                        aWaitable,
                                PendingEventsMap::iterator& pit,
                                AutoLockBase&               aAlock)
{
    if (mActive)
    {
        /*
         * We release lock here to allow modifying ops on EventSource inside callback.
         */
        HRESULT rc =  S_OK;
        if (mListener)
        {
            aAlock.release();
            rc = mListener->HandleEvent(aEvent);
#ifdef RT_OS_WINDOWS
            Assert(rc != RPC_E_WRONG_THREAD);
#endif
            aAlock.acquire();
        }
        if (aWaitable)
            eventProcessed(aEvent, pit);
        return rc;
    }
    return enqueue(aEvent);
}
void Horus::Commons::Logger::FooSink::onEventAccept(Logger::Event* event)
{
    emit eventProcessed
    (
        QString("[%1 : %2] (%3) %4").arg
        (
            event->timestamp.toString("hh:mm:ss/dd.MM.yy"),
            levelToStr(event->level),
            event->logger_name,
            event->msg
        )
    );
}
Exemple #3
0
IBase::Boolean                                                              //V6
  ATimeHandler :: dispatchHandlerEvent(IEvent& event)                       //V6
{                                                                           //V6
  Boolean eventProcessed(false);        //Assume event will not be proccessed V6
/*--------------------------- Test the Event -----------------------------|   V6
| This event must be a timer event and parameter 1 must contain the       |   V6
|   ID of the timer that was started by this handler.                     |   V6
|------------------------------------------------------------------------*/ //V6
  if ((event.eventId() == WM_TIMER) && (event.parameter1() == timerId))     //V6
  {                                                                         //V6
/*------------------------- Process Timer Event --------------------------|   V6
| Process the timer event by calling the virtual function tick, which     |   V6
|   should be overridden by an inheriting class.  The returned boolean    |   V6
|   value determines whether the event was actually processed by tick.    |   V6
|   The default ATimeHandler::tick function does not process the event.   |   V6
|------------------------------------------------------------------------*/ //V6
    eventProcessed = tick(event);                                           //V6
  }                                                                         //V6
  return (eventProcessed);                                                  //V6
} /* end ATimeHandler :: dispatchHandlerEvent(...) */                       //V6
Exemple #4
0
ListenerRecord::~ListenerRecord()
{
    /* Remove references to us from the event map */
    EventMap* aEvMap = &mOwner->m->mEvMap;
    for (int j = FirstEvent; j < LastEvent; j++)
    {
        (*aEvMap)[j - FirstEvent].remove(this);
    }

    if (!mActive)
    {
        // at this moment nobody could add elements to our queue, so we can safely
        // clean it up, otherwise there will be pending events map elements
        PendingEventsMap* aPem = &mOwner->m->mPendingMap;
        while (true)
        {
            ComPtr<IEvent> aEvent;

            if (mQueue.empty())
                break;

            mQueue.front().queryInterfaceTo(aEvent.asOutParam());
            mQueue.pop_front();

            BOOL aWaitable = FALSE;
            aEvent->COMGETTER(Waitable)(&aWaitable);
            if (aWaitable)
            {
                PendingEventsMap::iterator pit = aPem->find(aEvent);
                if (pit != aPem->end())
                    eventProcessed(aEvent, pit);
            }
        }

        ::RTCritSectDelete(&mcsQLock);
        ::RTSemEventDestroy(mQEvent);
    }
}