Exemplo n.º 1
0
// thread for active objects -------------------------------------------------
void QF::thread_(QMActive *act) {
    // enable thread-loop, see NOTE2
    act->m_osObject = static_cast<uint32_t>(1);  // set event-loop control
    do {
        QEvt const *e = act->get_(); // wait for event
        act->dispatch(e); // dispatch to the active object's state machine
        gc(e); // check if the event is garbage, and collect it if so
    } while (act->m_osObject != static_cast<uint32_t>(0));
    act->unsubscribeAll();
    OS_DeleteMB(&act->m_eQueue);
}
Exemplo n.º 2
0
/*-----------------------------------------------------------------------------------
 * Deallocates a mailbox. If there are messages still present in the
 * mailbox when the mailbox is deallocated, it is an indication of a
 * programming error in lwIP and the developer should be notified.
 */
void sys_mbox_free( /*@special@*/ sys_mbox_t *mbox ) /*@releases *mbox@*/
{
    e_mailbox_t* embox = (e_mailbox_t*)(*mbox);
    // free the Mailbox and then free the buffer
    OS_DeleteMB(&embox->mbox);
    free(embox->buffer);
    free(embox);
    {
        /* Line for breakpoint.  Should never break here! */
#ifdef __GNUC__
        __asm volatile ( "NOP" );
#elif defined( __IAR_SYSTEMS_ICC__ )
        asm( "NOP" );
#endif
    }
    // don't know why but FreeRTOS implementation has it. Probably want to give a chance for context switch.
    OS_Delay(1);
}
Exemplo n.º 3
0
/*..........................................................................*/
static void thread_function(void *pVoid) { /* embOS signature */
    QActive *act = (QActive *)pVoid;

#ifdef __TARGET_FPU_VFP
    /* does the task use the FPU? see NOTE1 */
    if ((act->osObject & QF_TASK_USES_FPU) != (uint32_t)0) {
        OS_ExtendTaskContext_VFP();
    }
#endif  /* __TARGET_FPU_VFP */

    act->osObject = (uint32_t)1; /* enable the event-loop, see NOTE2 */
    while (act->osObject != (uint32_t)0) {  /* event-loop */
        QEvt const *e = QActive_get_(act);
        QMSM_DISPATCH(&act->super, e);
        QF_gc(e); /* check if the event is garbage, and collect it if so */
    }

    QF_remove_(act); /* remove this object from QF */
    OS_DeleteMB(&act->eQueue);
    OS_TerminateTask(&act->thread);
}
/*
 * Destroy the mbox and release the space it took up in the pool
 */
void sys_mbox_free(sys_mbox_t mbox)
{
   OS_DeleteMB(mbox);
   free(mbox);
}