muduo
muduo copied to clipboard
Event-driven network library for multi-threaded Linux server in C++11
## Linux distro and version? x86 or ARM? 32-bit or 64-bit? ## Branch (master/cpp11/cpp17) and version of muduo? ## Version of cmake, gcc and boost? (If not from distro.)
MariaDB Async Client Using Non-blocking API Reference: https://mariadb.com/kb/en/using-the-non-blocking-library/ https://github.com/MariaDB/server/blob/5.5/client/async_example.c https://github.com/MariaDB/server/blob/5.5/tests/async_queries.c https://mariadb.com/kb/en/non-blocking-api-reference/ Build: centos7-x86_64: yum install mariadb-devel mariadb-libs ubuntu14.04-x86_64: apt-get install libmariadbclient-dev ln -sf libmariadbclient.so libmysqlclient.so
EventLoop在进入epoll_wait之前可以确定当前线程初始化完成,但是没有办法知道已经进入epoll_wait阻塞中, 如果此时在主线程中获取到了这个EventLoop并调用了runInLoop那么会发生的情况是:wakeup()并不会产生效果(因为EventLoop的线程此时还没有进入到epoll_wait中),这个事件(比如定时器事件)将会阻塞kPollTimeMs个时间,在下一帧中被执行. 虽然最终还是会被执行到,但是并不是预期结果(一秒的定时器,结果在10秒后被执行)。 我也正在尝试写一个网络库,所以有在学习muduo, 目前我比较头疼的问题是,我的epoll_wait时间并不是固定的,会根据当前的最近一个定时器的事件来计算epoll_wait的超时时间(如果没有那么就-1永久阻塞,或者被网络IO唤醒).换句话说假设kPollTimeMs是-1,出现我上述的情况时,定时器将永远不会被执行直到被网络IO唤醒。 请问 这种情况有什么比较好的解决方案没。 苦恼!!!!
参照Logger::Impl::formatTime来处理,更加合理,并且能够让log文件内容的时间和log文件名保持一致性。 新的代码,如下: string LogFile::getLogFileName(const string& basename, time_t* now) { string filename; filename.reserve(basename.size() + 64); filename = basename; char timebuf[32]; struct tm tm; *now = time(NULL); if (g_logTimeZone.valid()) { tm =...
之前回复过大神,我现在有一些想法,关于TcpClient销毁,但是回调仍然依赖于这个对象或者子对象,我这里在回调部分,全都使用了智能指针,并且将Connector的构造函数隐藏,只能使用Connector::create来创造智能指针对象,避免使用者,在使用过程中,在栈中构造Connector,在我的工程代码环境中测试过,没有出现之前提到的由于对象销毁,回调时依赖于无效的指针的问题,大神可以看看,这样改行不行
Add body field for HttpRequest, but only support the POST method, not support the GET method.