1
0
mirror of https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git synced 2025-07-17 10:52:46 +00:00

pnUtRef started at zero refs instead of one, and this is simpler

than finding and removing all the extra Ref() calls.
This commit is contained in:
2014-04-08 20:41:50 -07:00
parent d713a13dbe
commit 23a071860e
9 changed files with 22 additions and 14 deletions

View File

@ -48,6 +48,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "../../Pch.h"
#pragma hdrstop
#include "hsRefCnt.h"
/*****************************************************************************
*
@ -55,7 +57,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
*
***/
struct AsyncThreadTaskList : AtomicRef {
struct AsyncThreadTaskList : hsAtomicRefCnt {
ENetError error;
AsyncThreadTaskList ();
~AsyncThreadTaskList ();
@ -79,7 +81,7 @@ static HANDLE s_taskPort;
//===========================================================================
AsyncThreadTaskList::AsyncThreadTaskList ()
: error(kNetSuccess)
: hsAtomicRefCnt(0), error(kNetSuccess)
{
PerfAddCounter(kAsyncPerfThreadTaskListCount, 1);
}
@ -139,7 +141,7 @@ static unsigned THREADCALL ThreadTaskProc (AsyncThread * thread) {
if (task) {
task->callback(task->param, task->taskList->error);
task->taskList->DecRef("task");
task->taskList->Ref("task");
delete task;
}
}
@ -227,7 +229,7 @@ void AsyncThreadTaskSetThreadCount (unsigned threads) {
AsyncThreadTaskList * AsyncThreadTaskListCreate () {
ASSERT(s_taskPort);
AsyncThreadTaskList * taskList = new AsyncThreadTaskList;
taskList->IncRef("TaskList");
taskList->Ref("TaskList");
return taskList;
}
@ -241,7 +243,7 @@ void AsyncThreadTaskListDestroy (
ASSERT(!taskList->error);
taskList->error = error;
taskList->DecRef(); // REF:TaskList
taskList->UnRef(); // REF:TaskList
}
//===========================================================================
@ -263,7 +265,7 @@ void AsyncThreadTaskAdd (
task->callback = callback;
task->param = param;
StrCopy(task->debugStr, debugStr, arrsize(task->debugStr)); // this will be sent with the deadlock checker email if this thread exceeds time set in plServer.ini
taskList->IncRef("Task");
taskList->Ref("Task");
PostQueuedCompletionStatus(s_taskPort, 0, (DWORD) task, NULL);
}