mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-09-17 16:58: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:
@@ -55,15 +55,12 @@ extern bool SDL_FindInHashTable(const SDL_HashTable *table, const void *key, con
|
||||
// This function is thread-safe if the hashtable was created with threadsafe = true
|
||||
extern bool SDL_HashTableEmpty(SDL_HashTable *table);
|
||||
|
||||
extern void SDL_LockHashTable(SDL_HashTable *table, bool for_writing);
|
||||
extern void SDL_UnlockHashTable(SDL_HashTable *table);
|
||||
|
||||
// iterate all values for a specific key. This only makes sense if the hash is stackable. If not-stackable, just use SDL_FindInHashTable().
|
||||
// This function is not thread-safe, you should use SDL_LockHashTable() if necessary
|
||||
// This function is not thread-safe, you should use external locking if you use this function
|
||||
extern bool SDL_IterateHashTableKey(const SDL_HashTable *table, const void *key, const void **_value, void **iter);
|
||||
|
||||
// iterate all key/value pairs in a hash (stackable hashes can have duplicate keys with multiple values).
|
||||
// This function is not thread-safe, you should use SDL_LockHashTable() if necessary
|
||||
// This function is not thread-safe, you should use external locking if you use this function
|
||||
extern bool SDL_IterateHashTable(const SDL_HashTable *table, const void **_key, const void **_value, void **iter);
|
||||
|
||||
extern Uint32 SDL_HashPointer(const void *key, void *unused);
|
||||
|
Reference in New Issue
Block a user