-
Notifications
You must be signed in to change notification settings - Fork 1
/
navi.cc
47 lines (37 loc) · 1.16 KB
/
navi.cc
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
36
37
38
39
40
41
42
43
44
45
46
47
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include "DisplayThread.h"
#include "AcceleratorThread.h"
#include "PulseTimer.h"
#include "NaviData.h"
int main(void)
{
printf("Main thread started!\n");
Mutex mutex;
NaviData* naviData = new NaviData();
// creating DAP and DD threads
DisplayThread* displayThread = new DisplayThread(mutex, naviData);
AcceleratorThread* acceleratorThread = new AcceleratorThread(mutex, naviData);
// creating timers for each thread with specified pulse interval
PulseTimer* displayTimer = new PulseTimer(6, displayThread->getChannelId());
PulseTimer* acceleratorTimer = new PulseTimer(2, acceleratorThread->getChannelId());
printf("\n\n\t-------------Begin---------------\n\n");
// start timers and threads
displayThread->start();
displayTimer->start();
acceleratorThread->start();
acceleratorTimer->start();
// terminate threads
displayThread->join();
acceleratorThread->join();
printf("\n\n\t-------------END-----------------\n\n");
// cleanup
delete displayTimer;
delete acceleratorTimer;
delete displayThread;
delete acceleratorThread;
delete naviData;
printf("Main thread done!\n");
return EXIT_SUCCESS;
}