mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-18 11:19:10 +00:00
Merge pnUtRef with hsRefCnt, and remove the former
This commit is contained in:
@ -48,6 +48,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
#include "Pch.h"
|
||||
#include "hsThread.h"
|
||||
#include <list>
|
||||
#include "hsRefCnt.h"
|
||||
#pragma hdrstop
|
||||
|
||||
|
||||
@ -72,7 +73,7 @@ private:
|
||||
hsMutex m_critsect;
|
||||
};
|
||||
|
||||
struct NetMsgChannel : AtomicRef {
|
||||
struct NetMsgChannel : hsAtomicRefCnt {
|
||||
uint32_t m_protocol;
|
||||
bool m_server;
|
||||
|
||||
@ -109,7 +110,7 @@ ChannelCrit::~ChannelCrit () {
|
||||
while (s_channels->size()) {
|
||||
NetMsgChannel* const channel = s_channels->front();
|
||||
s_channels->remove(channel);
|
||||
channel->DecRef("ChannelLink");
|
||||
channel->UnRef("ChannelLink");
|
||||
}
|
||||
|
||||
delete s_channels;
|
||||
@ -275,7 +276,7 @@ static NetMsgChannel* FindOrCreateChannel_CS (uint32_t protocol, bool server) {
|
||||
channel->m_largestRecv = 0;
|
||||
|
||||
s_channels->push_back(channel);
|
||||
channel->IncRef("ChannelLink");
|
||||
channel->Ref("ChannelLink");
|
||||
}
|
||||
|
||||
return channel;
|
||||
@ -298,7 +299,7 @@ NetMsgChannel * NetMsgChannelLock (
|
||||
s_channelCrit.Enter();
|
||||
if (nil != (channel = FindChannel_CS(protocol, server))) {
|
||||
*largestRecv = channel->m_largestRecv;
|
||||
channel->IncRef("ChannelLock");
|
||||
channel->Ref("ChannelLock");
|
||||
}
|
||||
else {
|
||||
*largestRecv = 0;
|
||||
@ -313,7 +314,7 @@ void NetMsgChannelUnlock (
|
||||
) {
|
||||
s_channelCrit.Enter();
|
||||
{
|
||||
channel->DecRef("ChannelLock");
|
||||
channel->UnRef("ChannelLock");
|
||||
}
|
||||
s_channelCrit.Leave();
|
||||
}
|
||||
@ -392,7 +393,7 @@ void NetMsgProtocolRegister (
|
||||
// make sure no connections have been established on this protocol, otherwise
|
||||
// we'll be modifying a live data structure; NetCli's don't lock their protocol
|
||||
// to operate on it once they have linked to it!
|
||||
ASSERT(channel->GetRefCount() == 1);
|
||||
ASSERT(channel->RefCnt() == 1);
|
||||
|
||||
channel->m_dh_g = dh_g;
|
||||
channel->m_dh_xa = dh_xa;
|
||||
@ -411,7 +412,7 @@ void NetMsgProtocolDestroy (uint32_t protocol, bool server) {
|
||||
s_channelCrit.EnterSafe();
|
||||
if (NetMsgChannel* channel = FindChannel_CS(protocol, server)) {
|
||||
s_channels->remove(channel);
|
||||
channel->DecRef("ChannelLink");
|
||||
channel->UnRef("ChannelLink");
|
||||
}
|
||||
s_channelCrit.LeaveSafe();
|
||||
}
|
||||
|
Reference in New Issue
Block a user