#define BABELTRACE_OBJECT_POOL_INTERNAL_H
/*
- * Copyright (c) 2018 EfficiOS Inc. and Linux Foundation
* Copyright (c) 2018 Philippe Proulx <pproulx@efficios.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
pool->size--;
obj = pool->objects->pdata[pool->size];
pool->objects->pdata[pool->size] = NULL;
-
- if (obj->is_shared) {
- /* Object is shared: reset reference count to 1 */
- obj->ref_count.count = 1;
- }
goto end;
}
static inline
void bt_object_pool_recycle_object(struct bt_object_pool *pool, void *obj)
{
+ struct bt_object *bt_obj = obj;
+
BT_ASSERT(pool);
BT_ASSERT(obj);
g_ptr_array_set_size(pool->objects, pool->size + 1);
}
+ /* Reset reference count to 1 since it could be 0 now */
+ bt_obj->ref_count = 1;
+
+ /* Back to the pool */
pool->objects->pdata[pool->size] = obj;
pool->size++;