diff include/core/session.h @ 291:9a88e1725fd2

*: refactor lots of stuff I forgot to put this into different commits, oops! anyway, it doesn't really matter *that* much since this is an unfinished hobby project anyway. once it starts getting stable commit history will be more important, but for now it's not that big of a deal
author Paper <paper@paper.us.eu.org>
date Sun, 12 May 2024 16:31:07 -0400
parents 3ec7804abf17
children ac1451035c85
line wrap: on
line diff
--- a/include/core/session.h	Wed May 08 17:32:28 2024 -0400
+++ b/include/core/session.h	Sun May 12 16:31:07 2024 -0400
@@ -7,21 +7,22 @@
 
 #include "semver/semver.hpp"
 
-class MainWindow;
+#include <atomic>
 
 struct Session {
 public:
 	Session() { timer.start(); }
 	/* we literally *cannot* be lying to the user by doing this */
 	void IncrementRequests() { requests++; };
-	int GetRequests() { return requests; };
+	unsigned int GetRequests() { return requests; };
 	int uptime() { return timer.elapsed(); }
 
 	Config config;
 	static constexpr semver::version version{PACKAGE_VERSION};
 
 private:
-	unsigned int requests = 0;
+	/* IncrementRequests() gets called by different threads */
+	std::atomic<unsigned int> requests = 0;
 	QElapsedTimer timer;
 };