aboutsummaryrefslogtreecommitdiff
path: root/aufgabe4/monitor.c
blob: 2da4a552e4010bd058ca0a63b11252e070fee3f3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/*
 * vim:ts=4:sw=4:expandtab
 *
 * © 2010 Michael Stapelberg
 * 
 */
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>

#include "queue.h"

/*
 * Monitor-Prozess. Gibt die empfangenen Daten aus.
 *
 */
void monitor() {
    while (1) {
        /* Wir warten auf Nachrichten des CONV-Prozesses */
        while (queue_get_dir() != D_STAT_TO_MON)
            usleep(1);

        uint8_t data = queue_get_data();
        printf("Empfangenes Datum: %d\n", data);
        fflush(stdout);
    }
}

/*
 * Cleanup-Funktion. Beendet den Prozess.
 *
 */
void monitor_cleanup() {
    _exit(EXIT_SUCCESS);
}