--------------------- PatchSet 1078 Date: 2004/10/03 11:56:47 Author: serassio Branch: nt Tag: (none) Log: Updated awin32 after recent MenPools objectification Members: src/fs/awin32/aiops.cc:1.2.18.4->1.2.18.5 src/fs/awin32/async_io.cc:1.2.18.3->1.2.18.4 Index: squid3/src/fs/awin32/aiops.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/fs/awin32/Attic/aiops.cc,v retrieving revision 1.2.18.4 retrieving revision 1.2.18.5 diff -u -r1.2.18.4 -r1.2.18.5 --- squid3/src/fs/awin32/aiops.cc 21 Jun 2004 21:35:07 -0000 1.2.18.4 +++ squid3/src/fs/awin32/aiops.cc 3 Oct 2004 11:56:47 -0000 1.2.18.5 @@ -1,5 +1,5 @@ /* - * $Id: aiops.cc,v 1.2.18.4 2004/06/21 21:35:07 serassio Exp $ + * $Id: aiops.cc,v 1.2.18.5 2004/10/03 11:56:47 serassio Exp $ * * DEBUG: section 43 AIOPS * AUTHOR: Stewart Forster @@ -135,15 +135,15 @@ #define AIO_TINY_BUFS AIO_LARGE_BUFS >> 3 #define AIO_MICRO_BUFS 128 -static MemPool *squidaio_large_bufs = NULL; /* 16K */ -static MemPool *squidaio_medium_bufs = NULL; /* 8K */ -static MemPool *squidaio_small_bufs = NULL; /* 4K */ -static MemPool *squidaio_tiny_bufs = NULL; /* 2K */ -static MemPool *squidaio_micro_bufs = NULL; /* 128K */ +static MemAllocatorProxy *squidaio_large_bufs = NULL; /* 16K */ +static MemAllocatorProxy *squidaio_medium_bufs = NULL; /* 8K */ +static MemAllocatorProxy *squidaio_small_bufs = NULL; /* 4K */ +static MemAllocatorProxy *squidaio_tiny_bufs = NULL; /* 2K */ +static MemAllocatorProxy *squidaio_micro_bufs = NULL; /* 128K */ static int request_queue_len = 0; -static MemPool *squidaio_request_pool = NULL; -static MemPool *squidaio_thread_pool = NULL; +static MemAllocatorProxy *squidaio_request_pool = NULL; +static MemAllocatorProxy *squidaio_thread_pool = NULL; static squidaio_request_queue_t request_queue; static struct @@ -169,10 +169,10 @@ static HANDLE main_thread; -static MemPool * +static MemAllocatorProxy * squidaio_get_pool(int size) { - MemPool *p; + MemAllocatorProxy *p; if (size <= AIO_LARGE_BUFS) { if (size <= AIO_MICRO_BUFS) @@ -195,10 +195,10 @@ squidaio_xmalloc(int size) { void *p; - MemPool *pool; + MemAllocatorProxy *pool; if ((pool = squidaio_get_pool(size)) != NULL) { - p = memPoolAlloc(pool); + p = pool->alloc(); } else p = xmalloc(size); @@ -220,10 +220,10 @@ void squidaio_xfree(void *p, int size) { - MemPool *pool; + MemAllocatorProxy *pool; if ((pool = squidaio_get_pool(size)) != NULL) { - memPoolFree(pool, p); + pool->free(p); } else xfree(p); } @@ -231,11 +231,11 @@ static void squidaio_xstrfree(char *str) { - MemPool *pool; + MemAllocatorProxy *pool; int len = strlen(str) + 1; if ((pool = squidaio_get_pool(len)) != NULL) { - memPoolFree(pool, str); + pool->free(str); } else xfree(str); } @@ -309,12 +309,12 @@ done_queue.blocked = 0; /* Create threads and get them to sit in their wait loop */ - squidaio_thread_pool = memPoolCreate("aio_thread", sizeof(squidaio_thread_t)); + squidaio_thread_pool = new MemAllocatorProxy("aio_thread", sizeof(squidaio_thread_t)); assert(NUMTHREADS); for (i = 0; i < NUMTHREADS; i++) { - threadp = (squidaio_thread_t *)memPoolAlloc(squidaio_thread_pool); + threadp = (squidaio_thread_t *)squidaio_thread_pool->alloc(); threadp->status = _THREAD_STARTING; threadp->current_req = NULL; threadp->requests = 0; @@ -338,17 +338,17 @@ } /* Create request pool */ - squidaio_request_pool = memPoolCreate("aio_request", sizeof(squidaio_request_t)); + squidaio_request_pool = new MemAllocatorProxy("aio_request", sizeof(squidaio_request_t)); - squidaio_large_bufs = memPoolCreate("squidaio_large_bufs", AIO_LARGE_BUFS); + squidaio_large_bufs = new MemAllocatorProxy("squidaio_large_bufs", AIO_LARGE_BUFS); - squidaio_medium_bufs = memPoolCreate("squidaio_medium_bufs", AIO_MEDIUM_BUFS); + squidaio_medium_bufs = new MemAllocatorProxy("squidaio_medium_bufs", AIO_MEDIUM_BUFS); - squidaio_small_bufs = memPoolCreate("squidaio_small_bufs", AIO_SMALL_BUFS); + squidaio_small_bufs = new MemAllocatorProxy("squidaio_small_bufs", AIO_SMALL_BUFS); - squidaio_tiny_bufs = memPoolCreate("squidaio_tiny_bufs", AIO_TINY_BUFS); + squidaio_tiny_bufs = new MemAllocatorProxy("squidaio_tiny_bufs", AIO_TINY_BUFS); - squidaio_micro_bufs = memPoolCreate("squidaio_micro_bufs", AIO_MICRO_BUFS); + squidaio_micro_bufs = new MemAllocatorProxy("squidaio_micro_bufs", AIO_MICRO_BUFS); squidaio_initialised = 1; } @@ -707,7 +707,7 @@ resultp->aio_errno = requestp->err; } - memPoolFree(squidaio_request_pool, requestp); + squidaio_request_pool->free(requestp); } /* squidaio_cleanup_request */ @@ -738,7 +738,7 @@ if (!squidaio_initialised) squidaio_init(); - requestp = (squidaio_request_t *)memPoolAlloc(squidaio_request_pool); + requestp = (squidaio_request_t *)squidaio_request_pool->alloc(); requestp->path = (char *) squidaio_xstrdup(path); @@ -776,7 +776,7 @@ if (!squidaio_initialised) squidaio_init(); - requestp = (squidaio_request_t *)memPoolAlloc(squidaio_request_pool); + requestp = (squidaio_request_t *)squidaio_request_pool->alloc(); requestp->fd = fd; @@ -827,7 +827,7 @@ if (!squidaio_initialised) squidaio_init(); - requestp = (squidaio_request_t *)memPoolAlloc(squidaio_request_pool); + requestp = (squidaio_request_t *)squidaio_request_pool->alloc(); requestp->fd = fd; @@ -879,7 +879,7 @@ if (!squidaio_initialised) squidaio_init(); - requestp = (squidaio_request_t *)memPoolAlloc(squidaio_request_pool); + requestp = (squidaio_request_t *)squidaio_request_pool->alloc(); requestp->fd = fd; @@ -917,7 +917,7 @@ if (!squidaio_initialised) squidaio_init(); - requestp = (squidaio_request_t *)memPoolAlloc(squidaio_request_pool); + requestp = (squidaio_request_t *)squidaio_request_pool->alloc(); requestp->path = (char *) squidaio_xstrdup(path); @@ -955,7 +955,7 @@ if (!squidaio_initialised) squidaio_init(); - requestp = (squidaio_request_t *)memPoolAlloc(squidaio_request_pool); + requestp = (squidaio_request_t *)squidaio_request_pool->alloc(); requestp->path = squidaio_xstrdup(path); @@ -988,7 +988,7 @@ if (!squidaio_initialised) squidaio_init(); - requestp = (squidaio_request_t *)memPoolAlloc(squidaio_request_pool); + requestp = (squidaio_request_t *)squidaio_request_pool->alloc(); requestp->path = (char *) squidaio_xstrdup(path); @@ -1028,7 +1028,7 @@ if (!squidaio_initialised) squidaio_init(); - requestp = memPoolAlloc(squidaio_request_pool); + requestp = squidaio_request_pool->alloc(); resultp->result_type = _AIO_OP_OPENDIR; Index: squid3/src/fs/awin32/async_io.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/fs/awin32/Attic/async_io.cc,v retrieving revision 1.2.18.3 retrieving revision 1.2.18.4 diff -u -r1.2.18.3 -r1.2.18.4 --- squid3/src/fs/awin32/async_io.cc 21 Jun 2004 21:35:07 -0000 1.2.18.3 +++ squid3/src/fs/awin32/async_io.cc 3 Oct 2004 11:56:47 -0000 1.2.18.4 @@ -1,6 +1,6 @@ /* - * $Id: async_io.cc,v 1.2.18.3 2004/06/21 21:35:07 serassio Exp $ + * $Id: async_io.cc,v 1.2.18.4 2004/10/03 11:56:47 serassio Exp $ * * DEBUG: section 32 Asynchronous Disk I/O * AUTHOR: Pete Bentley @@ -96,7 +96,7 @@ static dlink_list used_list; static OBJH aioStats; -static MemPool *squidaio_ctrl_pool; +static MemAllocatorProxy *squidaio_ctrl_pool; static void aioFDWasClosed(int fd); static void @@ -112,7 +112,7 @@ if (initialised) return; - squidaio_ctrl_pool = memPoolCreate("aio_ctrl", sizeof(squidaio_ctrl_t)); + squidaio_ctrl_pool = new MemAllocatorProxy("aio_ctrl", sizeof(squidaio_ctrl_t)); cachemgrRegister("squidaio_counts", "Async IO Function Counters", aioStats, 0, 1); @@ -127,7 +127,9 @@ return; squidaio_shutdown(); - memPoolDestroy(&squidaio_ctrl_pool); + delete squidaio_ctrl_pool; + + squidaio_ctrl_pool = NULL; initialised = false; } @@ -139,7 +141,7 @@ assert(AufsIO::Instance.initialised); squidaio_counts.open_start++; - ctrlp = (squidaio_ctrl_t *)memPoolAlloc(squidaio_ctrl_pool); + ctrlp = (squidaio_ctrl_t *)squidaio_ctrl_pool->alloc(); ctrlp->fd = -2; ctrlp->done_handler = callback; ctrlp->done_handler_data = cbdataReference(callback_data); @@ -158,7 +160,7 @@ assert(AufsIO::Instance.initialised); squidaio_counts.close_start++; aioCancel(fd); - ctrlp = (squidaio_ctrl_t *)memPoolAlloc(squidaio_ctrl_pool); + ctrlp = (squidaio_ctrl_t *)squidaio_ctrl_pool->alloc(); ctrlp->fd = fd; ctrlp->done_handler = NULL; ctrlp->done_handler_data = NULL; @@ -206,7 +208,7 @@ } dlinkDelete(m, &used_list); - memPoolFree(squidaio_ctrl_pool, ctrlp); + squidaio_ctrl_pool->free(ctrlp); } } @@ -219,7 +221,7 @@ assert(AufsIO::Instance.initialised); squidaio_counts.write_start++; - ctrlp = (squidaio_ctrl_t *)memPoolAlloc(squidaio_ctrl_pool); + ctrlp = (squidaio_ctrl_t *)squidaio_ctrl_pool->alloc(); ctrlp->fd = fd; ctrlp->done_handler = callback; ctrlp->done_handler_data = cbdataReference(callback_data); @@ -248,7 +250,7 @@ assert(AufsIO::Instance.initialised); squidaio_counts.read_start++; - ctrlp = (squidaio_ctrl_t *)memPoolAlloc(squidaio_ctrl_pool); + ctrlp = (squidaio_ctrl_t *)squidaio_ctrl_pool->alloc(); ctrlp->fd = fd; ctrlp->done_handler = callback; ctrlp->done_handler_data = cbdataReference(callback_data); @@ -277,7 +279,7 @@ assert(AufsIO::Instance.initialised); squidaio_counts.stat_start++; - ctrlp = (squidaio_ctrl_t *)memPoolAlloc(squidaio_ctrl_pool); + ctrlp = (squidaio_ctrl_t *)squidaio_ctrl_pool->alloc(); ctrlp->fd = -2; ctrlp->done_handler = callback; ctrlp->done_handler_data = cbdataReference(callback_data); @@ -294,7 +296,7 @@ squidaio_ctrl_t *ctrlp; assert(AufsIO::Instance.initialised); squidaio_counts.unlink_start++; - ctrlp = (squidaio_ctrl_t *)memPoolAlloc(squidaio_ctrl_pool); + ctrlp = (squidaio_ctrl_t *)squidaio_ctrl_pool->alloc(); ctrlp->fd = -2; ctrlp->done_handler = callback; ctrlp->done_handler_data = cbdataReference(callback_data); @@ -310,7 +312,7 @@ squidaio_ctrl_t *ctrlp; assert(AufsIO::Instance.initialised); squidaio_counts.unlink_start++; - ctrlp = (squidaio_ctrl_t *)memPoolAlloc(squidaio_ctrl_pool); + ctrlp = (squidaio_ctrl_t *)squidaio_ctrl_pool->alloc(); ctrlp->fd = -2; ctrlp->done_handler = callback; ctrlp->done_handler_data = cbdataReference(callback_data); @@ -407,7 +409,7 @@ if (ctrlp->operation == _AIO_CLOSE) aioFDWasClosed(ctrlp->fd); - memPoolFree(squidaio_ctrl_pool, ctrlp); + squidaio_ctrl_pool->free(ctrlp); } return retval; @@ -452,5 +454,5 @@ int aioQueueSize(void) { - return memPoolInUseCount(squidaio_ctrl_pool); + return squidaio_ctrl_pool->inUseCount(); }