On 12/01/2014 03:47 AM, Bill Fischofer wrote:
+int odp_buffer_pool_destroy(odp_buffer_pool_t pool_hdl)
+{
+       uint32_t pool_id = pool_handle_to_index(pool_hdl);
+       pool_entry_t *pool = get_pool_entry(pool_id);

-       if (chunk->chunk.num_bufs == 0) {
-               /* give the chunk buffer */
-               local_chunk[pool_id] = NULL;
-               chunk->buf_hdr.type = pool->s.buf_type;
+       if (pool == NULL)
+               return -1;

-               handle = chunk->buf_hdr.handle;
-       } else {
-               odp_buffer_hdr_t *hdr;
-               uint32_t index;
-               index = rem_buf_index(chunk);
-               hdr = index_to_hdr(pool, index);
+       LOCK(&pool->s.lock);

-               handle = hdr->handle;
+       if (pool->s.pool_shm == ODP_SHM_INVALID ||
+           odp_atomic_load_u32(&pool->s.bufcount) > 0 ||
+           pool->s.flags.predefined) {
+               UNLOCK(&pool->s.lock);
+               return -1;
        }

-       return handle.u32;
-}
+       if (!pool->s.flags.user_supplied_shm)
+               odp_shm_free(pool->s.pool_shm);

+       pool->s.pool_shm = 0;

should be ODP_SHM_INVALID instead of 0.

+       UNLOCK(&pool->s.lock);

_______________________________________________
lng-odp mailing list
[email protected]
http://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to