🔒 Used the wrong locks 🔒
This commit is contained in:
parent
d756e8626b
commit
93cb764c23
@ -199,7 +199,7 @@ namespace Assets
|
|||||||
replacementFound = true;
|
replacementFound = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, false, false);
|
}, false);
|
||||||
|
|
||||||
if (!replacementFound)
|
if (!replacementFound)
|
||||||
{
|
{
|
||||||
@ -236,7 +236,7 @@ namespace Assets
|
|||||||
replacementFound = true;
|
replacementFound = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, false, false);
|
}, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!replacementFound && asset->techniqueSet)
|
if (!replacementFound && asset->techniqueSet)
|
||||||
@ -274,7 +274,7 @@ namespace Assets
|
|||||||
replacementFound = true;
|
replacementFound = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, false, false);
|
}, false);
|
||||||
|
|
||||||
if (!replacementFound)
|
if (!replacementFound)
|
||||||
{
|
{
|
||||||
|
@ -981,7 +981,7 @@ namespace Components
|
|||||||
replacementFound = true;
|
replacementFound = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, false, false);
|
}, false);
|
||||||
|
|
||||||
if (replacementFound) return ret;
|
if (replacementFound) return ret;
|
||||||
return "";
|
return "";
|
||||||
|
@ -504,12 +504,16 @@ namespace Game
|
|||||||
|
|
||||||
vec3_t* CorrectSolidDeltas = reinterpret_cast<vec3_t*>(0x739BB8); // Count 26
|
vec3_t* CorrectSolidDeltas = reinterpret_cast<vec3_t*>(0x739BB8); // Count 26
|
||||||
|
|
||||||
void Sys_UnlockWrite(FastCriticalSection* critSect)
|
void Sys_LockRead(FastCriticalSection* critSect)
|
||||||
{
|
{
|
||||||
assert(critSect->writeCount > 0);
|
InterlockedIncrement(&critSect->readCount);
|
||||||
|
while (critSect->writeCount) std::this_thread::sleep_for(1ms);
|
||||||
|
}
|
||||||
|
|
||||||
InterlockedDecrement(&critSect->writeCount);
|
void Sys_UnlockRead(FastCriticalSection* critSect)
|
||||||
Sys_TempPriorityEnd(&critSect->tempPriority);
|
{
|
||||||
|
assert(critSect->readCount > 0);
|
||||||
|
InterlockedDecrement(&critSect->readCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
XAssetHeader ReallocateAssetPool(XAssetType type, unsigned int newSize)
|
XAssetHeader ReallocateAssetPool(XAssetType type, unsigned int newSize)
|
||||||
@ -626,10 +630,9 @@ namespace Game
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DB_EnumXAssetEntries(XAssetType type, std::function<void(XAssetEntry*)> callback, bool overrides, bool lock)
|
void DB_EnumXAssetEntries(XAssetType type, std::function<void(XAssetEntry*)> callback, bool overrides)
|
||||||
{
|
{
|
||||||
if (lock)
|
Sys_LockRead(db_hashCritSect);
|
||||||
Sys_LockWrite(db_hashCritSect);
|
|
||||||
|
|
||||||
const auto pool = Components::Maps::GetAssetEntryPool();
|
const auto pool = Components::Maps::GetAssetEntryPool();
|
||||||
for(auto hash = 0; hash < 37000; hash++)
|
for(auto hash = 0; hash < 37000; hash++)
|
||||||
@ -658,8 +661,7 @@ namespace Game
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(lock)
|
Sys_UnlockRead(db_hashCritSect);
|
||||||
Sys_UnlockWrite(db_hashCritSect);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// this cant be MessageBox because windows.h has a define that converts it to MessageBoxW. which is just stupid
|
// this cant be MessageBox because windows.h has a define that converts it to MessageBoxW. which is just stupid
|
||||||
|
@ -1034,7 +1034,8 @@ namespace Game
|
|||||||
|
|
||||||
extern vec3_t* CorrectSolidDeltas;
|
extern vec3_t* CorrectSolidDeltas;
|
||||||
|
|
||||||
void Sys_UnlockWrite(FastCriticalSection*);
|
void Sys_LockRead(FastCriticalSection* critSect);
|
||||||
|
void Sys_UnlockRead(FastCriticalSection* critSect);
|
||||||
|
|
||||||
XAssetHeader ReallocateAssetPool(XAssetType type, unsigned int newSize);
|
XAssetHeader ReallocateAssetPool(XAssetType type, unsigned int newSize);
|
||||||
void Menu_FreeItemMemory(Game::itemDef_s* item);
|
void Menu_FreeItemMemory(Game::itemDef_s* item);
|
||||||
@ -1049,7 +1050,7 @@ namespace Game
|
|||||||
XAssetType DB_GetXAssetNameType(const char* name);
|
XAssetType DB_GetXAssetNameType(const char* name);
|
||||||
int DB_GetZoneIndex(const std::string& name);
|
int DB_GetZoneIndex(const std::string& name);
|
||||||
bool DB_IsZoneLoaded(const char* zone);
|
bool DB_IsZoneLoaded(const char* zone);
|
||||||
void DB_EnumXAssetEntries(XAssetType type, std::function<void(XAssetEntry*)> callback, bool overrides, bool lock);
|
void DB_EnumXAssetEntries(XAssetType type, std::function<void(XAssetEntry*)> callback, bool overrides);
|
||||||
XAssetHeader DB_FindXAssetDefaultHeaderInternal(XAssetType type);
|
XAssetHeader DB_FindXAssetDefaultHeaderInternal(XAssetType type);
|
||||||
XAssetEntry* DB_FindXAssetEntry(XAssetType type, const char* name);
|
XAssetEntry* DB_FindXAssetEntry(XAssetType type, const char* name);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user