initial port for Cevo game in C++ (libs)
This commit is contained in:
commit
8436242032
375 files changed
+46282
No files matched your search
@@ -0,0 +1,22 @@
|
||||
#pragma once
|
||||
|
||||
#include <QMutex>
|
||||
|
||||
namespace Cevo {
|
||||
|
||||
// Equivalent of SyncCounter.pas's TSyncCounter: a thread-safe counter/ID allocator.
|
||||
class SyncCounter {
|
||||
public:
|
||||
int allocate();
|
||||
bool currentEqualTo(int value) const;
|
||||
void increment();
|
||||
// NOTE: matches the original, which copies Top/Current without locking.
|
||||
void assign(const SyncCounter &source);
|
||||
|
||||
private:
|
||||
mutable QMutex m_lock;
|
||||
int m_top = 0;
|
||||
int m_current = 0;
|
||||
};
|
||||
|
||||
} // namespace Cevo
|
||||
Reference in new issue
Block a user