Skip to content
Snippets Groups Projects
Commit 1a9b8a9a authored by D-AIRY's avatar D-AIRY
Browse files

Threadsafe refcounting

parent d0b7f53f
No related branches found
No related tags found
No related merge requests found
......@@ -292,7 +292,7 @@ QT стиль документирования (!) и QT_AUTOBRIEF - корот
#ifndef __SKYXENGINE_H
#define __SKYXENGINE_H
#define SKYXENGINE_VERSION "X.7.1"
#define SKYXENGINE_VERSION "X.8.0-dev"
#define SKYXENGINE_VERSION4EDITORS "SkyXEngine version " ## SKYXENGINE_VERSION
......
......@@ -351,7 +351,7 @@ void CDynamicModelProvider::computeVisibility(const IFrustum *pFrustum, CRendera
{
pVisibility->setItemCountDynamic(m_apModels.size());
pVisibility->resetItemTransparentDynamic();
#if 0
#if 1
CVisUpdate cycle(pFrustum, pVisibility, pReference, m_apModels);
ID id = m_pCore->getAsyncTaskRunner()->forLoop(0, m_apModels.size(), &cycle, 500);
m_pCore->getAsyncTaskRunner()->waitForLoop(id);
......
......@@ -159,8 +159,12 @@ struct IBaseObject
class IXUnknown
{
protected:
IXUnknown()
{
m_uRefCount.store(1);
}
virtual ~IXUnknown() = default;
UINT m_uRefCount = 1;
std::atomic_uint m_uRefCount;
public:
void XMETHODCALLTYPE AddRef()
{
......@@ -168,8 +172,7 @@ public:
}
virtual void XMETHODCALLTYPE Release()
{
--m_uRefCount;
if(!m_uRefCount)
if(!--m_uRefCount)
{
delete this;
}
......@@ -186,7 +189,11 @@ template <class T>
class IXUnknownImplementation: public T
{
private:
UINT m_uRefCount = 1;
IXUnknownImplementation()
{
m_uRefCount.store(1);
}
std::atomic_uint m_uRefCount;
public:
void XMETHODCALLTYPE AddRef() override
{
......@@ -194,8 +201,7 @@ public:
}
virtual void XMETHODCALLTYPE Release() override
{
--m_uRefCount;
if(!m_uRefCount)
if(!--m_uRefCount)
{
delete this;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment