-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsnapshot.h
More file actions
49 lines (40 loc) · 1.41 KB
/
Copy pathsnapshot.h
File metadata and controls
49 lines (40 loc) · 1.41 KB
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
48
49
// snapshot.h - the data the renderer draws each frame.
//
// The viz task on the pump thread writes g_snap under g_snap_mu every pump
// round; the render thread reads a copy under the same mutex. Cross-thread, so
// it carries a mutex (unlike simulator, where the renderer is itself a flow on
// the pump and needs none).
#pragma once
#include "globals.h"
#include <mutex>
#include <string>
#include <vector>
struct Snapshot
{
// mailbox snapshot (front-to-back, not popped)
std::vector<Message> queue;
// professor
int prof_emitted = 0;
int prof_total = 0;
std::string prof_phase;
bool prof_idle = true;
// friend
int friend_emitted = 0;
int friend_total = 0;
std::string friend_phase;
bool friend_idle = true;
// student
Message student_current;
bool student_has_msg = false;
int student_ability = 0;
int student_stress = 0;
int student_hours = 0;
int student_done = 0;
std::string student_phase;
bool student_idle = true;
// recent activity (most recent last)
std::vector<std::string> recent;
};
extern std::mutex g_snap_mu;
extern Snapshot g_snap;
Snapshot ReadSnapshot();