docs/Writerside/topics/mempool.h.md

changeset 1283
89935fea4b7c
parent 1282
0c8077f67e54
--- a/docs/Writerside/topics/mempool.h.md	Fri Apr 11 14:49:23 2025 +0200
+++ b/docs/Writerside/topics/mempool.h.md	Fri Apr 11 15:12:20 2025 +0200
@@ -62,6 +62,9 @@
 #include <cx/mempool.h>
 
 int cxMempoolTransfer(CxMempool *source, CxMempool *dest);
+
+int cxMempoolTransferObject(CxMempool *source, CxMempool *dest,
+        const void *obj);
 ```
 
 Memory managed by a pool can be transferred to another pool.
@@ -71,7 +74,11 @@
 That means, that all references to the allocator of the `source` pool remain valid and continue to work with the `dest` pool.
 The transferred allocator will be destroyed when the `dest` pool gets destroyed.
 
-The function returns zero when the transfer was successful and non-zero if a necessary memory allocation was not possible,
+The function `cxMempoolTransferObject()` transfers a _single_ object managed by the `source` pool to the `dest` pool.
+Memory that was registered with `cxMempoolRegister()` cannot be transferred this way.
+Also, if `obj` has a reference to `source->allocator`, it must be updated to `dest->allocator` manually.
+
+The functions returns zero when the transfer was successful and non-zero if a necessary memory allocation was not possible,
 or the `source` and `dest` pointers point to the same pool.
 In case of an error, no memory is transferred and both pools are in a valid state.
 

mercurial