X-Git-Url: https://git.distorted.org.uk/~mdw/mLib/blobdiff_plain/18c831dcd0ae4d660c70ccac69d27ed2a97851be..6999eaf70483790afb2e50f58e2543caf5af6066:/mem/pool.3 diff --git a/mem/pool.3 b/mem/pool.3 index 4881bf1..5acc7b2 100644 --- a/mem/pool.3 +++ b/mem/pool.3 @@ -29,6 +29,18 @@ pool \- resource pool management .nf .B "#include " +.B "typedef struct { ...\& } pool;" + +.B "typedef struct {" +.B "\h'4n'pool_resource *next;" +.BI "\h'4n'void (*destroy)(pool_resource *" r ); +.B "} pool_resource;" + +.B "typedef struct {" +.B "\h'4n'FILE *fp;" +.B "\h'4n'..." +.B "} pool_file;" + .BI "void pool_init(pool *" p ", arena *" a ); .BI "pool *pool_create(arena *" a ); .BI "pool *pool_sub(pool *" p ); @@ -119,15 +131,9 @@ for memory allocation. .SS "Other resources" Pool resources have a header of type .B pool_resource -with the structure: -.VS -typedef struct pool_resource { - struct pool_resource *next; - void (*destroy)(struct pool_resource */*r*/); -} pool_resource; -.VE -Resources are added to the pool by passing a pointer to the pool, the -resource block and a destruction function to +with the structure shown in the synopsis. Resources are added to the +pool by passing a pointer to the pool, the resource block and a +destruction function to .BR pool_add . .PP If your resource is freed before the pool is destroyed, manually zero