utils: ref_get() returns the new value of the reference counter
This allows us to use ref_get() for getting unique values.
This commit is contained in:
@@ -466,11 +466,15 @@ static pthread_mutex_t ref_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
/**
|
||||
* Increase refcount
|
||||
*/
|
||||
void ref_get(refcount_t *ref)
|
||||
refcount_t ref_get(refcount_t *ref)
|
||||
{
|
||||
refcount_t current;
|
||||
|
||||
pthread_mutex_lock(&ref_mutex);
|
||||
(*ref)++;
|
||||
current = ++(*ref);
|
||||
pthread_mutex_unlock(&ref_mutex);
|
||||
|
||||
return current;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user