int myqtt_hash_lock_until_changed ( MyQttHash hash_table,
long  wait_microseconds 
)

Allows the callers to get locked until a change is detected on the hash table (insert, update or remove operation) found or the wait period is reached (wait_microseconds).

During the lock operation the hash table remains usable to other callers (including threads).

Parameters
hash_tableThe hash table to wait for changes.
wait_microsecondsThe amount of time to wait. If 0 is used, it will wait without limit until next change is produced.
Returns
The function returns -2 in the case wrong parameters are received (NULL hash table reference or negative value for wait_microseconds). The function returns 0 in the case the wait_microseconds period is reached without any change. 1 is returned in the case a change is detected during the wait_microseconds. Once the function returns, the change has already taken place.

References myqtt_async_queue_new(), myqtt_async_queue_pop(), myqtt_async_queue_timedpop(), myqtt_hash_unref(), myqtt_mutex_lock(), and myqtt_mutex_unlock().