src/server/daemon/threadpools.c

changeset 490
d218607f5a7e
parent 415
d938228c382e
equal deleted inserted replaced
489:921f83a8943f 490:d218607f5a7e
45 static threadpool_t *default_io_pool; 45 static threadpool_t *default_io_pool;
46 static threadpool_t *last_io_pool; 46 static threadpool_t *last_io_pool;
47 47
48 int create_threadpool(cxstring name, ThreadPoolConfig *cfg) { 48 int create_threadpool(cxstring name, ThreadPoolConfig *cfg) {
49 if(thread_pool_map == NULL) { 49 if(thread_pool_map == NULL) {
50 thread_pool_map = cxHashMapCreate(cxDefaultAllocator, 16); 50 thread_pool_map = cxHashMapCreate(cxDefaultAllocator, CX_STORE_POINTERS, 16);
51 } 51 }
52 52
53 CxHashKey key = cx_hash_key_bytes((const unsigned char*)name.ptr, name.length); 53 CxHashKey key = cx_hash_key_bytes((const unsigned char*)name.ptr, name.length);
54 threadpool_t *pool = cxMapGet(thread_pool_map, key); 54 threadpool_t *pool = cxMapGet(thread_pool_map, key);
55 if(pool) { 55 if(pool) {
83 } 83 }
84 } 84 }
85 85
86 int create_io_pool(cxstring name, int numthreads) { 86 int create_io_pool(cxstring name, int numthreads) {
87 if(io_pool_map == NULL) { 87 if(io_pool_map == NULL) {
88 io_pool_map = cxHashMapCreate(cxDefaultAllocator, 4); 88 io_pool_map = cxHashMapCreate(cxDefaultAllocator, CX_STORE_POINTERS, 4);
89 } 89 }
90 CxHashKey key = cx_hash_key_bytes((const unsigned char*)name.ptr, name.length); 90 CxHashKey key = cx_hash_key_bytes((const unsigned char*)name.ptr, name.length);
91 threadpool_t *pool = cxMapGet(io_pool_map, key); 91 threadpool_t *pool = cxMapGet(io_pool_map, key);
92 if(pool) { 92 if(pool) {
93 pool->min_threads = numthreads; 93 pool->min_threads = numthreads;

mercurial