-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
37 lines (30 loc) · 791 Bytes
/
main.cpp
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
#include "AppTracker.h"
#include <iostream>
#include <thread>
AppTracker appTracker;
void startTrackingWrapper()
{
try {
appTracker.startTracking();
} catch (std::runtime_error& e) {
throw std::runtime_error(e.what());
}
}
int main()
{
// Start tracking in a separate thread
std::thread trackingThread(startTrackingWrapper);
// Wait for user input
std::cout << "Press Enter to stop tracking..." << std::endl;
std::cin.get(); // Wait for Enter key
// Stop tracking
appTracker.stopTracking();
// Join the thread
if (trackingThread.joinable()) {
trackingThread.join();
}
std::cout << "Tracking stopped." << std::endl;
std::cout << appTracker << std::endl;
appTracker.clearTracking();
return 0;
}