mirror of
https://github.com/barkeser2002/flower.git
synced 2026-09-25 19:36:20 +03:00
20 lines
390 B
C++
20 lines
390 B
C++
#include "delegate.h"
|
|
#include <mutex>
|
|
|
|
namespace engine
|
|
{
|
|
DelegateHandle::HandleType DelegateHandle::getNewID()
|
|
{
|
|
static HandleType runtimeID = 0;
|
|
|
|
// Valid state check.
|
|
// uint64_t is very large and should never overflow.
|
|
if (runtimeID == kInvalidID)
|
|
{
|
|
runtimeID = 0;
|
|
}
|
|
|
|
// Increment and return.
|
|
return runtimeID ++;
|
|
}
|
|
} |