예제 #1
0
파일: qf_port.c 프로젝트: JPLOpenSource/SCA
/*..........................................................................*/
static void *thread_routine(void *arg) {    /* the expected POSIX signature */
    ((QActive *)arg)->running = (uint8_t)1; /* allow the thread loop to run */
    while (((QActive *)arg)->running) {   /* QActive_stop() stopps the loop */
        QEvent const *e = QActive_get_((QActive *)arg);/*wait for the event */
        QF_ACTIVE_DISPATCH_(&((QActive *)arg)->super, e);/* dispatch to  SM */
        QF_gc(e);    /* check if the event is garbage, and collect it if so */
    }
    QF_remove_((QActive *)arg);/* remove this object from any subscriptions */
    return (void *)0;                                     /* return success */
}
예제 #2
0
파일: qf_port.c 프로젝트: JPLOpenSource/SCA
/*..........................................................................*/
static DWORD WINAPI thread_function(LPVOID arg) {     /* for CreateThread() */
    ((QActive *)arg)->running = (uint8_t)1; /* allow the thread loop to run */
    while (((QActive *)arg)->running) {    /* QActive_stop() stops the loop */
        QEvent const *e = QActive_get_((QActive *)arg);   /* wait for event */
        QF_ACTIVE_DISPATCH_((QHsm *)arg, e);     /* dispatch to the AO's SM */
        QF_gc(e);    /* check if the event is garbage, and collect it if so */
    }
    QF_remove_((QActive *)arg);/* remove this object from any subscriptions */
    return 0;                                             /* return success */
}
예제 #3
0
/*..........................................................................*/
static DWORD WINAPI thread_function(LPVOID arg) {     /* for CreateThread() */
    do {                                   /* QActive_stop() stops the loop */
        QEvt const *e = QActive_get_((QActive *)arg);     /* wait for event */
        QMSM_DISPATCH((QMsm *)arg, e);           /* dispatch to the AO's SM */
        QF_gc(e);    /* check if the event is garbage, and collect it if so */
    } while (((QActive *)arg)->thread != (HANDLE)0);
    QF_remove_((QActive *)arg);/* remove this object from any subscriptions */
    CloseHandle(((QActive *)arg)->osObject);        /* cleanup the OS event */
    return 0;                                             /* return success */
}
예제 #4
0
파일: qf_port.c 프로젝트: JPLOpenSource/SCA
/*..........................................................................*/
static void task_function(void *pdata) {         /* uC/OS-II task signature */
    ((QActive *)pdata)->running = (uint8_t)1;     /* enable the thread-loop */
    while (((QActive *)pdata)->running) {
        QEvent const *e = QActive_get_((QActive *)pdata);
        QF_ACTIVE_DISPATCH_(&((QActive *)pdata)->super, e);
        QF_gc(e);    /* check if the event is garbage, and collect it if so */
    }

    QF_remove_((QActive *)pdata);  /* remove this object from the framework */
    OSTaskDel(OS_PRIO_SELF);        /* make uC/OS-II forget about this task */
}
예제 #5
0
/* thread for active objects -----------------------------------------------*/
static void ao_thread(void const *argument);  /* prototype */
static void ao_thread(void const *argument) { /* RTX signature */
    QActive *act = (QActive *)argument;
    act->osObject = (uint32_t)1; /* enable thread-loop, see NOTE2 */
    while (act->osObject != (uint32_t)0) {
        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 */
    osThreadTerminate(act->thread); /* CMSIS-RTX: remove the thread */
}
예제 #6
0
/*..........................................................................*/
static void *thread_routine(void *arg) { /* the expected POSIX signature */
    QActive *act = (QActive *)arg;
    /* loop until m_thread is cleared in QActive_stop() */
    do {
        QEvt const *e = QActive_get_(act); /* wait for the event */
        QMSM_DISPATCH(&act->super, e);     /* dispatch to the SM */
        QF_gc(e);    /* check if the event is garbage, and collect it if so */
    } while (act->thread != (uint8_t)0);
    QF_remove_(act); /* remove this object from any subscriptions */
    pthread_cond_destroy(&act->osObject); /* cleanup the condition variable */
    return (void *)0; /* return success */
}
예제 #7
0
static DWORD WINAPI ao_thread(LPVOID arg) { /* for CreateThread() */
    QActive *act = (QActive *)arg;

    /* Active Object's event loop. QActive_stop() stops the loop */
    do {
        QEvt const *e = QActive_get_(act); /* wait for event */
        QMSM_DISPATCH(&act->super, e);     /* dispatch to the AO's SM */
        QF_gc(e); /* check if the event is garbage, and collect it if so */
    } while (act->thread != (HANDLE)0);

    QActive_unsubscribeAll(act); /* make sure that no events are subscribed */
    QF_remove_(act);  /* remove this object from any subscriptions */
    CloseHandle(act->osObject); /* cleanup the OS event */
    free((void *)act->eQueue.ring); /* free the fudged queue storage */
    return (DWORD)0; /* return success */
}
예제 #8
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);
}
예제 #9
0
/*..........................................................................*/
void QActive_stop(QActive *me) {
    QF_remove_(me);
}
/*..........................................................................*/
void QActive_stop(QActive *me) {
    QF_remove_(me);                /* remove this active object from the QF */
}