mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-18 11:19:10 +00:00
More std::atomic and friends
This commit is contained in:
@ -133,8 +133,8 @@ static HASHTABLEDECL(TransState, THashKeyVal<unsigned>, link) s_trans;
|
||||
static HASHTABLEDECL(IGameCli, THashKeyVal<unsigned>, link) s_games;
|
||||
static std::map<plUUID, Factory*> s_factories;
|
||||
|
||||
static long s_transId;
|
||||
static ARRAYOBJ(plKey) s_receivers;
|
||||
static std::atomic<unsigned> s_transId;
|
||||
static ARRAYOBJ(plKey) s_receivers;
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
@ -163,11 +163,7 @@ AUTO_INIT_FUNC (SetGameMgrMsgHandler) {
|
||||
|
||||
//============================================================================
|
||||
static inline unsigned INextTransId () {
|
||||
|
||||
unsigned transId = AtomicAdd(&s_transId, 1);
|
||||
while (!transId)
|
||||
transId = AtomicAdd(&s_transId, 1);
|
||||
return transId;
|
||||
return ++s_transId;
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user