libco icon indicating copy to clipboard operation
libco copied to clipboard

libco is a coroutine library which is widely used in wechat back-end service. It has been running on tens of thousands of machines since 2013.

Results 109 libco issues
Sort by recently updated
recently updated
newest added

https://linux.die.net/man/3/gethostbyname_r declare gethostbyname_r is GNU extension, so macos not support

fixed example_setenv crash bug, because of sprintf is not thread safe

直接co_accept出来的fd,没有调用fcntl设置为非阻塞,此时write函数里是否还是为阻塞写? 为什么不直接在co_accept里设置 fcntl(cli, F_SETFL, g_sys_fcntl_func(cli, F_GETFL,0 ));

``` void co_enable_hook_sys() //这函数必须在这里,否则本文件会被忽略!!! { stCoRoutine_t *co = GetCurrThreadCo(); if( co ) { co->cEnableSysHook = 1; } } ``` 在阅读源码的时候对这段代码的注释不是很理解,有人可以帮忙解释一下吗,谢谢。 我在自己写的demo中测试hook系统函数,不管静态库还是动态库,能否hook系统函数只与链接库的顺序有关(先链接库的符号会覆盖后链接库的相同符号)

struct stCoRoutine_t *co_create_env( stCoRoutineEnv_t * env, const stCoRoutineAttr_t* attr, pfn_co_routine_t pfn,void *arg ) { stCoRoutineAttr_t at; if( attr ) { memcpy( &at,attr,sizeof(at) ); } if( at.stack_size 1024 * 1024 *...

在循环poll等待所连接的套接字可写的时候跳出循环的条件为`if( 1 == pollret &&)`,超时的时候也满足这个条件,失去了循环的意义,所以应该加上判断poll返回的事件不超时,大概是这样`if( 1 == pollret && pf.revents & POLLOUT )`。虽然25秒还连不上的时候比较少。