mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-09-14 15:28:13 +00:00
Removed external hashtable locking functions
Read-write locks are not recursive and can't be upgraded from one type to another, so it's not safe to lock the hash table and then call functions that operate on it. If you really want this functionality, we'd need to create unlocked versions of the hashtable functions and you would call those once you've taken a lock on the hashtable, and we'd have to assert that the operations you're doing are compatible with the type of lock you've taken. All of that complicates working with hashtables, so if you need that type of access, you should probably just use external locking.
This commit is contained in:
@@ -493,28 +493,6 @@ bool SDL_HashTableEmpty(SDL_HashTable *table)
|
||||
return !(table && table->num_occupied_slots);
|
||||
}
|
||||
|
||||
void SDL_LockHashTable(SDL_HashTable *table, bool for_writing)
|
||||
{
|
||||
if (!table) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (for_writing) {
|
||||
SDL_LockRWLockForWriting(table->lock);
|
||||
} else {
|
||||
SDL_LockRWLockForReading(table->lock);
|
||||
}
|
||||
}
|
||||
|
||||
void SDL_UnlockHashTable(SDL_HashTable *table)
|
||||
{
|
||||
if (!table) {
|
||||
return;
|
||||
}
|
||||
|
||||
SDL_UnlockRWLock(table->lock);
|
||||
}
|
||||
|
||||
static void nuke_all(SDL_HashTable *table)
|
||||
{
|
||||
void *data = table->data;
|
||||
|
Reference in New Issue
Block a user