FS-8821 #resolve [Check for status of executed operation]
This commit is contained in:
parent
a80c67e375
commit
cb280ab14b
|
@ -1443,18 +1443,18 @@ SWITCH_DECLARE(void *) switch_core_hash_delete(_In_ switch_hash_t *hash, _In_z_
|
|||
\param hash the hash to delete from
|
||||
\param key the key from which to delete the data
|
||||
\param mutex optional mutex to lock
|
||||
\return SWITCH_STATUS_SUCCESS if the data is deleted
|
||||
\return a pointer to the deleted data
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_hash_delete_locked(_In_ switch_hash_t *hash, _In_z_ const char *key, _In_opt_ switch_mutex_t *mutex);
|
||||
SWITCH_DECLARE(void *) switch_core_hash_delete_locked(_In_ switch_hash_t *hash, _In_z_ const char *key, _In_opt_ switch_mutex_t *mutex);
|
||||
|
||||
/*!
|
||||
\brief Delete data from a hash based on desired key
|
||||
\param hash the hash to delete from
|
||||
\param key the key from which to delete the data
|
||||
\param mutex optional rwlock to wrlock
|
||||
\return SWITCH_STATUS_SUCCESS if the data is deleted
|
||||
\return a pointer to the deleted data
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_hash_delete_wrlock(_In_ switch_hash_t *hash, _In_z_ const char *key, _In_opt_ switch_thread_rwlock_t *rwlock);
|
||||
SWITCH_DECLARE(void *) switch_core_hash_delete_wrlock(_In_ switch_hash_t *hash, _In_z_ const char *key, _In_opt_ switch_thread_rwlock_t *rwlock);
|
||||
|
||||
/*!
|
||||
\brief Delete data from a hash based on callback function
|
||||
|
|
|
@ -66,32 +66,36 @@ SWITCH_DECLARE(switch_status_t) switch_core_hash_insert_destructor(switch_hash_t
|
|||
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_hash_insert_locked(switch_hash_t *hash, const char *key, const void *data, switch_mutex_t *mutex)
|
||||
{
|
||||
switch_status_t status = SWITCH_STATUS_FALSE;
|
||||
|
||||
if (mutex) {
|
||||
switch_mutex_lock(mutex);
|
||||
}
|
||||
|
||||
switch_core_hash_insert(hash, key, data);
|
||||
status = switch_core_hash_insert(hash, key, data);
|
||||
|
||||
if (mutex) {
|
||||
switch_mutex_unlock(mutex);
|
||||
}
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
return status;
|
||||
}
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_hash_insert_wrlock(switch_hash_t *hash, const char *key, const void *data, switch_thread_rwlock_t *rwlock)
|
||||
{
|
||||
switch_status_t status = SWITCH_STATUS_FALSE;
|
||||
|
||||
if (rwlock) {
|
||||
switch_thread_rwlock_wrlock(rwlock);
|
||||
}
|
||||
|
||||
switch_core_hash_insert(hash, key, data);
|
||||
status = switch_core_hash_insert(hash, key, data);
|
||||
|
||||
if (rwlock) {
|
||||
switch_thread_rwlock_unlock(rwlock);
|
||||
}
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
return status;
|
||||
}
|
||||
|
||||
SWITCH_DECLARE(void *) switch_core_hash_delete(switch_hash_t *hash, const char *key)
|
||||
|
@ -99,8 +103,10 @@ SWITCH_DECLARE(void *) switch_core_hash_delete(switch_hash_t *hash, const char *
|
|||
return switch_hashtable_remove(hash, (void *)key);
|
||||
}
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_hash_delete_locked(switch_hash_t *hash, const char *key, switch_mutex_t *mutex)
|
||||
SWITCH_DECLARE(void *) switch_core_hash_delete_locked(switch_hash_t *hash, const char *key, switch_mutex_t *mutex)
|
||||
{
|
||||
void *ret = NULL;
|
||||
|
||||
if (mutex) {
|
||||
switch_mutex_lock(mutex);
|
||||
}
|
||||
|
@ -111,22 +117,24 @@ SWITCH_DECLARE(switch_status_t) switch_core_hash_delete_locked(switch_hash_t *ha
|
|||
switch_mutex_unlock(mutex);
|
||||
}
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
return ret;
|
||||
}
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_hash_delete_wrlock(switch_hash_t *hash, const char *key, switch_thread_rwlock_t *rwlock)
|
||||
SWITCH_DECLARE(void *) switch_core_hash_delete_wrlock(switch_hash_t *hash, const char *key, switch_thread_rwlock_t *rwlock)
|
||||
{
|
||||
void *ret = NULL;
|
||||
|
||||
if (rwlock) {
|
||||
switch_thread_rwlock_wrlock(rwlock);
|
||||
}
|
||||
|
||||
switch_core_hash_delete(hash, key);
|
||||
ret = switch_core_hash_delete(hash, key);
|
||||
|
||||
if (rwlock) {
|
||||
switch_thread_rwlock_unlock(rwlock);
|
||||
}
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
return ret;
|
||||
}
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_hash_delete_multi(switch_hash_t *hash, switch_hash_delete_callback_t callback, void *pData) {
|
||||
|
|
Loading…
Reference in New Issue