tencent-wechat / libco Goto Github PK
View Code? Open in Web Editor NEWCoroutine library for C/C++
License: Other
Coroutine library for C/C++
License: Other
co_routine.cpp:
static stCoRoutineEnv_t* g_arrCoEnvPerThread[ 102400 ] = { 0 };
采用数组的好处显而易见,但以pid索引这个数组很可能越界。需要该为其他数据结构。
As poll has been hooked, they can be easily implemented.
After hooked them, we can simply write period "consumer" program (offline scanner).
因为poll已经被挂钩,所以sleep和usleep可以轻松的用poll来实现协程式的休眠。
如果 sleep和usleep被挂钩,我们可以轻松的实现周期性工作的消费者程序(在离线扫描程序中很常见)。
如题,23333
因为很多第三方库(比如hiredis或者mysql c driver) 创建连接时使用的是同步connect的函数, 接入libco后,mysql c driver 调用 mysql_real_connect 会返回115错误,调试发现当调用到hook的connect函数后,直接返回ret -1, errno为115。
我觉得这里是不是应该模拟同步connect时的ret, 即发起连接请求后立即调用co_poll yield出去,等待connect成功后再回到这里返回正确的ret。
现在的实现导致mysql c driver无法正确连接成功。
https://github.com/Tencent/libco/ 这里的版本的connect实现是对的。
不支持Mac系统???
只看到他转去调用gethostbyname_r了。但是离无阻塞还远吧?
是不方便使用getaddrinfo_a吗?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.