{"id":13436436,"url":"https://github.com/Tencent/libco","last_synced_at":"2025-03-18T21:30:32.580Z","repository":{"id":39177731,"uuid":"70655231","full_name":"Tencent/libco","owner":"Tencent","description":"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.","archived":false,"fork":false,"pushed_at":"2024-03-07T09:08:03.000Z","size":191,"stargazers_count":8449,"open_issues_count":131,"forks_count":2103,"subscribers_count":480,"default_branch":"master","last_synced_at":"2025-03-13T02:07:48.822Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Tencent.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-10-12T02:36:47.000Z","updated_at":"2025-03-12T18:41:24.000Z","dependencies_parsed_at":"2024-10-27T19:13:48.872Z","dependency_job_id":null,"html_url":"https://github.com/Tencent/libco","commit_stats":{"total_commits":70,"total_committers":21,"mean_commits":"3.3333333333333335","dds":0.7285714285714286,"last_synced_commit":"dc6aafcc5e643d3b454a58acdc78e223634bbd1e"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tencent%2Flibco","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tencent%2Flibco/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tencent%2Flibco/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tencent%2Flibco/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Tencent","download_url":"https://codeload.github.com/Tencent/libco/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244310268,"owners_count":20432505,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T03:00:48.231Z","updated_at":"2025-03-18T21:30:29.774Z","avatar_url":"https://github.com/Tencent.png","language":"C++","readme":"Libco\n===========\nLibco is a c/c++ coroutine library that is widely used in WeChat services. It has been running on tens of thousands of machines since 2013.\n\nBy linking with libco, you can easily transform synchronous back-end service into coroutine service. The coroutine service will provide out-standing concurrency compare to multi-thread approach. With the system hook, You can easily coding in synchronous way but asynchronous executed.\n\nYou can also use co_create/co_resume/co_yield interfaces to create asynchronous back-end service. These interface will give you more control of coroutines.\n\nBy libco copy-stack mode, you can easily build a back-end service support tens of millions of tcp connection.\n***\n### 简介\nlibco是微信后台大规模使用的c/c++协程库，2013年至今稳定运行在微信后台的数万台机器上。  \n\nlibco通过仅有的几个函数接口 co_create/co_resume/co_yield 再配合 co_poll，可以支持同步或者异步的写法，如线程库一样轻松。同时库里面提供了socket族函数的hook，使得后台逻辑服务几乎不用修改逻辑代码就可以完成异步化改造。\n\n作者: sunnyxu(sunnyxu@tencent.com), leiffyli(leiffyli@tencent.com), dengoswei@gmail.com(dengoswei@tencent.com), sarlmolchen(sarlmolchen@tencent.com)\n\nPS: **近期将开源PaxosStore，敬请期待。**\n\n### libco的特性\n- 无需侵入业务逻辑，把多进程、多线程服务改造成协程服务，并发能力得到百倍提升;\n- 支持CGI框架，轻松构建web服务(New);\n- 支持gethostbyname、mysqlclient、ssl等常用第三库(New);\n- 可选的共享栈模式，单机轻松接入千万连接(New);\n- 完善简洁的协程编程接口\n * 类pthread接口设计，通过co_create、co_resume等简单清晰接口即可完成协程的创建与恢复；\n * __thread的协程私有变量、协程间通信的协程信号量co_signal (New);\n * 语言级别的lambda实现，结合协程原地编写并执行后台异步任务 (New);\n * 基于epoll/kqueue实现的小而轻的网络框架，基于时间轮盘实现的高性能定时器;\n\n### Build\n\n```bash\n$ cd /path/to/libco\n$ make\n```\n\nor use cmake\n\n```bash\n$ cd /path/to/libco\n$ mkdir build\n$ cd build\n$ cmake ..\n$ make\n```\n\n\n","funding_links":[],"categories":["C++","C/C++ 程序设计"],"sub_categories":["网络服务_其他"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FTencent%2Flibco","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FTencent%2Flibco","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FTencent%2Flibco/lists"}