connect_pool* connect_manager::peek(const char* key, bool exclusive /* = true */) { if (key == NULL || *key == 0) return peek(); size_t service_size; connect_pool* pool; unsigned n = acl_hash_crc32(key, strlen(key)); if (exclusive) lock_.lock(); service_size = pools_.size(); if (service_size == 0) { if (exclusive) lock_.unlock(); logger_warn("pools's size is 0!"); return NULL; } pool = pools_[n % service_size]; if (exclusive) lock_.unlock(); return pool; }
unsigned int queue_manager::hash_queueSub(const char* partName, unsigned width) { acl_assert(width > 0); unsigned int n = acl_hash_crc32(partName, strlen(partName)); return n % width; }