{"id":13415540,"url":"https://github.com/patrykstefanski/libfev","last_synced_at":"2025-03-14T23:30:46.871Z","repository":{"id":167620450,"uuid":"291828228","full_name":"patrykstefanski/libfev","owner":"patrykstefanski","description":"A library for events and fibers","archived":false,"fork":false,"pushed_at":"2020-12-12T19:12:11.000Z","size":146,"stargazers_count":34,"open_issues_count":0,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-07-31T21:54:04.072Z","etag":null,"topics":["coroutines","epoll","fibers","goroutines","iouring","kqueue"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/patrykstefanski.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2020-08-31T21:26:33.000Z","updated_at":"2024-01-15T16:45:32.000Z","dependencies_parsed_at":"2023-06-14T23:30:49.225Z","dependency_job_id":null,"html_url":"https://github.com/patrykstefanski/libfev","commit_stats":null,"previous_names":["patrykstefanski/libfev"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patrykstefanski%2Flibfev","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patrykstefanski%2Flibfev/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patrykstefanski%2Flibfev/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patrykstefanski%2Flibfev/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/patrykstefanski","download_url":"https://codeload.github.com/patrykstefanski/libfev/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243663210,"owners_count":20327299,"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":["coroutines","epoll","fibers","goroutines","iouring","kqueue"],"created_at":"2024-07-30T21:00:50.121Z","updated_at":"2025-03-14T23:30:46.550Z","avatar_url":"https://github.com/patrykstefanski.png","language":"C","funding_links":[],"categories":["Concurrency","C/C++"],"sub_categories":[],"readme":"# libfev\n\nA library for events and fibers (a.k.a. green threads/goroutines/stackful coroutines).\n\n[![CI](https://github.com/patrykstefanski/libfev/workflows/CI/badge.svg)](https://github.com/patrykstefanski/libfev/actions)\n\n## Overview\n\nlibfev is an abstraction over event-driven, non-blocking I/O for writing programs in C and C++ in a\nsimple blocking style. It provides:\n\n* Few multithreaded schedulers\n* Backends for epoll and kqueue (and experimental io\\_uring backend)\n* Timers\n* Synchronization primitives (mutex, condition variable and semaphore)\n\n## Performance\nIn a throughput benchmark libfev can handle up to 172% more requests per second than\n[Boost.Asio](https://www.boost.org/doc/libs/1_74_0/doc/html/boost_asio.html), up to 77% more than\n[Tokio](https://tokio.rs/), up to 40% more than [async-std](https://async.rs/) and up to 16% more\nthan [Go](https://golang.org/). See [async-bench](https://github.com/patrykstefanski/async-bench)\nfor more data, there is also a comparison of the available schedulers.\n\n## Support\n\nFollowing platforms are currently supported:\n\n* x86 (both 32- and 64-bit)\n* FreeBSD, Linux, macOS\n* DragonFlyBSD, NetBSD, OpenBSD should work too, but I haven't tested them yet\n* Clang \u003e= 9 or GCC \u003e= 8\n\n## Example\n\n```cpp\nvoid echo(fev::socket \u0026\u0026socket) try {\n  char buffer[1024];\n  for (;;) {\n    std::size_t num_read = socket.read(buffer, sizeof(buffer));\n    if (num_read == 0)\n      break;\n\n    socket.write(buffer, num_read);\n  }\n} catch (const std::system_error \u0026e) {\n  std::cerr \u003c\u003c \"[echo] \" \u003c\u003c e.what() \u003c\u003c '\\n';\n}\n\nvoid acceptor() {\n  fev::socket socket;\n  socket.open(AF_INET, SOCK_STREAM, 0);\n  socket.set_reuse_addr();\n  socket.bind(reinterpret_cast\u003csockaddr *\u003e(\u0026server_addr), sizeof(server_addr));\n  socket.listen(1024);\n  for (;;) {\n    auto new_socket = socket.accept();\n    fev::fiber::spawn(\u0026echo, std::move(new_socket));\n  }\n}\n```\n\nSee also [examples](examples).\n\n## Documentation\n\n* [Scheduler strategies](docs/SchedulerStrategies.md)\n\n## License\n\nLicensed under either of\n\n * Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or\n   http://www.apache.org/licenses/LICENSE-2.0)\n * MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)\n\nat your option.\n\n### Third party\n\nThis library includes some code written by third parties. Check [third\\_party](third_party) for\ntheir licenses.\n\n### Contribution\n\nUnless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the\nwork by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any\nadditional terms or conditions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpatrykstefanski%2Flibfev","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpatrykstefanski%2Flibfev","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpatrykstefanski%2Flibfev/lists"}