在我的代碼,我用升壓庫,並得到了錯誤,並在升壓::線程第一次運行時:錯誤:pipe_select_interrupter:打開的文件太多,在OS LINUX
terminate called after throwing an instance of 'boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::system::system_error> >'what():
pipe_select_interrupter: Too many open files.
我使用ulimit
並看到文件discriptors是300000允許的,我認爲它不能被使用。 代碼拋出錯誤:
CCohConnection *conn = new CCohConnection(this,CCohStack::GetIoService());
構造函數定義:
CCohConnection::CCohConnection(ICohClient *pClient,boost::asio::io_service &io_service):
m_pClient(pClient),m_oIoService(io_service),m_socket(io_service),m_resolver(io_service),m_timer(io_service)
{
printf("gouzao\n");
}
我計劃在此構造分手了,這裏是IOService的定義:
namespace coh{
class CCohStack
{
public:
static void Start();
static void Stop();
static boost::asio::io_service & GetIoService(){return sm_oIoService;}
private:
static boost::asio::io_service sm_oIoService;
static boost::asio::io_service::work *sm_oWork;
static boost::thread m_thread;
};
}
我們需要更多代碼([SSCCE](http://www.sscce.org/))。代碼並未顯示實際管理的資源生命週期。 – sehe