Changeset 594 for pjproject/trunk/pjlib/src/pj/pool_caching.c
- Timestamp:
- Jul 9, 2006 10:05:46 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjlib/src/pj/pool_caching.c
r588 r594 32 32 static void cpool_release_pool(pj_pool_factory *pf, pj_pool_t *pool); 33 33 static void cpool_dump_status(pj_pool_factory *factory, pj_bool_t detail ); 34 static pj_bool_t cpool_on_block_alloc(pj_pool_factory *f, pj_size_t sz); 35 static void cpool_on_block_free(pj_pool_factory *f, pj_size_t sz); 36 34 37 35 38 static pj_size_t pool_sizes[PJ_CACHING_POOL_ARRAY_SIZE] = … … 64 67 cp->factory.release_pool = &cpool_release_pool; 65 68 cp->factory.dump_status = &cpool_dump_status; 69 cp->factory.on_block_alloc = &cpool_on_block_alloc; 70 cp->factory.on_block_free = &cpool_on_block_free; 66 71 67 72 cp->pool = pj_pool_create_int(&cp->factory, "cachingpool", 256, … … 274 279 } 275 280 281 282 static pj_bool_t cpool_on_block_alloc(pj_pool_factory *f, pj_size_t sz) 283 { 284 pj_caching_pool *cp = (pj_caching_pool*)f; 285 286 //Can't lock because mutex is not recursive 287 //if (cp->mutex) pj_mutex_lock(cp->mutex); 288 289 cp->used_size += sz; 290 if (cp->used_size > cp->peak_used_size) 291 cp->peak_used_size = cp->used_size; 292 293 //if (cp->mutex) pj_mutex_unlock(cp->mutex); 294 295 return PJ_TRUE; 296 } 297 298 299 static void cpool_on_block_free(pj_pool_factory *f, pj_size_t sz) 300 { 301 pj_caching_pool *cp = (pj_caching_pool*)f; 302 303 //pj_mutex_lock(cp->mutex); 304 cp->used_size -= sz; 305 //pj_mutex_unlock(cp->mutex); 306 } 307 308 276 309 #endif /* PJ_HAS_POOL_ALT_API */ 277 310
Note: See TracChangeset
for help on using the changeset viewer.