src/ucx/mempool.h

changeset 99
b9a6af0ae41a
parent 91
fac51f87def0
child 135
471e28cca288
--- a/src/ucx/mempool.h	Mon Apr 06 16:36:25 2015 +0200
+++ b/src/ucx/mempool.h	Fri Oct 16 19:23:49 2015 +0200
@@ -1,7 +1,7 @@
 /*
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
  *
- * Copyright 2013 Olaf Wintermann. All rights reserved.
+ * Copyright 2015 Olaf Wintermann. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
@@ -47,24 +47,20 @@
 #endif
 
 /**
- * A function pointer to a destructor function.
- * @see ucx_mempool_setdestr()
- * @see ucx_mempool_regdestr()
- */
-typedef void(*ucx_destructor)(void*);
-
-/**
  * UCX mempool structure.
  */
 typedef struct {
+    /** UcxAllocator based on this pool */
+    UcxAllocator *allocator;
+    
     /** List of pointers to pooled memory. */
-    void   **data;
+    void         **data;
     
     /** Count of pooled memory items. */
-    size_t ndata;
+    size_t       ndata;
     
     /** Memory pool size. */
-    size_t size;
+    size_t       size;
 } UcxMempool;
 
 /** Shorthand for a new default memory pool with a capacity of 16 elements. */
@@ -118,7 +114,7 @@
 /**
  * Allocates a pooled memory array.
  * 
- * The contents of the allocated memory is set to zero.
+ * The content of the allocated memory is set to zero.
  * 
  * @param pool the memory pool
  * @param nelem amount of elements to allocate
@@ -139,7 +135,7 @@
  * @param pool the memory pool
  * @param ptr a pointer to the memory that shall be reallocated
  * @param n the new size of the memory
- * @return a pointer to the the location of the memory
+ * @return a pointer to the new location of the memory
  * @see ucx_allocator_realloc()
  */
 void *ucx_mempool_realloc(UcxMempool *pool, void *ptr, size_t n);
@@ -210,14 +206,6 @@
  */
 void ucx_mempool_reg_destr(UcxMempool *pool, void *ptr, ucx_destructor destr);
 
-/**
- * Creates an UcxAllocator based on an UcxMempool.
- * 
- * @param pool the mempool to create the UcxAllocator for
- * @return a new UcxAllocator based on the specified pool
- */
-UcxAllocator* ucx_mempool_allocator(UcxMempool *pool);
-
 #ifdef	__cplusplus
 }
 #endif

mercurial