/// 插入 void insert(session_ptr sp) { if (!sp) return ; BOOST_INTERLOCKED_INCREMENT(&size_); typename lock_type::scoped_lock lock(lock_); list_.push_back(sp.get()); }
/// 添加任务到线程池中 inline void push_task(Task const& task) { #if !defined(BEX_SUPPORT_CXX11) BOOST_INTERLOCKED_INCREMENT(&m_unfinished); #else ++ m_unfinished; #endif m_taskQueue.push(task); }
// 发起接受连接请求 void async_accept(bool reply = false) { if (!reply) { BOOST_INTERLOCKED_INCREMENT(&accept_count_); } socket_ptr sp = protocol_type::alloc_socket(ios_, opts_->receive_buffer_size, opts_->send_buffer_size); acceptor_.async_accept(sp->lowest_layer(), BEX_IO_BIND(&this_type::on_async_accept, this, BEX_IO_PH_ERROR, sp)); }
friend void intrusive_ptr_add_ref(thread_data_base * p) { BOOST_INTERLOCKED_INCREMENT(&p->count); }
void add_ref_copy() { BOOST_INTERLOCKED_INCREMENT( &use_count_ ); }
void weak_add_ref() // nothrow { BOOST_INTERLOCKED_INCREMENT( &weak_count_ ); }
static inline long interlocked_increment(long volatile *addr) { return BOOST_INTERLOCKED_INCREMENT(addr); }
SharedObj() { static volatile long inc; _ID = BOOST_INTERLOCKED_INCREMENT( &inc ); }