示例#1
0
void
threaded_listener::init(settings const &s) {
	if (!empty()) {
		boost::function<void()> f = boost::bind(&threaded_listener::thread_func, this);
		unsigned short threads = s.listener_threads();
		for (unsigned short i = 0; i < threads; ++i) {
			create_thread(f);
		}
	}
}
示例#2
0
void
threaded_listener::init(settings const &s) {
    if (!empty()) {
        unsigned short threads = s.listener_threads();
        if (!threads) {
            threads = 1;
        }
        for (unsigned int i = 0; i < threads; ++i) {
            items_.push_back(boost::shared_ptr<queue_type>(new queue_type()));
            boost::function<void()> f = boost::bind(&threaded_listener::thread_func, this, i);
            create_thread(f);
        }
    }
}