Mercurial > minori
comparison 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 |
comparison
equal
deleted
inserted
replaced
| 290:9347e2eaf6e5 | 291:9a88e1725fd2 |
|---|---|
| 5 #include "gui/locale.h" | 5 #include "gui/locale.h" |
| 6 #include <QElapsedTimer> | 6 #include <QElapsedTimer> |
| 7 | 7 |
| 8 #include "semver/semver.hpp" | 8 #include "semver/semver.hpp" |
| 9 | 9 |
| 10 class MainWindow; | 10 #include <atomic> |
| 11 | 11 |
| 12 struct Session { | 12 struct Session { |
| 13 public: | 13 public: |
| 14 Session() { timer.start(); } | 14 Session() { timer.start(); } |
| 15 /* we literally *cannot* be lying to the user by doing this */ | 15 /* we literally *cannot* be lying to the user by doing this */ |
| 16 void IncrementRequests() { requests++; }; | 16 void IncrementRequests() { requests++; }; |
| 17 int GetRequests() { return requests; }; | 17 unsigned int GetRequests() { return requests; }; |
| 18 int uptime() { return timer.elapsed(); } | 18 int uptime() { return timer.elapsed(); } |
| 19 | 19 |
| 20 Config config; | 20 Config config; |
| 21 static constexpr semver::version version{PACKAGE_VERSION}; | 21 static constexpr semver::version version{PACKAGE_VERSION}; |
| 22 | 22 |
| 23 private: | 23 private: |
| 24 unsigned int requests = 0; | 24 /* IncrementRequests() gets called by different threads */ |
| 25 std::atomic<unsigned int> requests = 0; | |
| 25 QElapsedTimer timer; | 26 QElapsedTimer timer; |
| 26 }; | 27 }; |
| 27 | 28 |
| 28 extern Session session; | 29 extern Session session; |
| 29 | 30 |
