示例#1
0
static void *phase1_thread(void *data) {
    phase1_cmp_t *cmp = data;

    while (cmp->running) {
        cmp->counter += 1;
        usleep(SLEEPTIME);
    }

    celixThread_exit(NULL);
    return NULL;
}
示例#2
0
static void *phase2b_thread(void *data) {
    phase2b_cmp_t *cmp = data;
    unsigned int counter;

    while (cmp->running) {
        celixThreadMutex_lock(&cmp->mutex);
        if (cmp->phase1Serv != NULL) {
            cmp->phase1Serv->getData(cmp->phase1Serv->handle, &counter);
            cmp->currentValue = counter / 1000;
        }
        celixThreadMutex_unlock(&cmp->mutex);
        usleep(SLEEPTIME);
    }

    celixThread_exit(NULL);
    return NULL;
}
示例#3
0
static void *phase3_thread(void *data) {
    phase3_cmp_t *cmp = data;
    int size;
    int i;
    double value;

    while (cmp->running) {
        size = arrayList_size(cmp->phase2Services);
        for (i = 0; i < size; i += 1) {
            phase2_t *serv = arrayList_get(cmp->phase2Services, i);
            serv->getData(serv->handle, &value);
            printf("PHASE3: Data from %p is %f\n", serv, value);
        }
        usleep(SLEEPTIME);
    }

    celixThread_exit(NULL);
    return NULL;
}