{"id":29602035,"url":"https://github.com/dislogical/libtlb","last_synced_at":"2026-06-05T22:31:27.344Z","repository":{"id":55724821,"uuid":"320918951","full_name":"dislogical/libtlb","owner":"dislogical","description":"A library for safely balancing event loop handlers across threads.","archived":false,"fork":false,"pushed_at":"2023-09-29T23:07:53.000Z","size":86,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-02-04T18:08:56.671Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dislogical.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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,"zenodo":null}},"created_at":"2020-12-12T20:35:39.000Z","updated_at":"2023-09-22T20:34:54.000Z","dependencies_parsed_at":"2025-05-12T23:47:08.823Z","dependency_job_id":null,"html_url":"https://github.com/dislogical/libtlb","commit_stats":null,"previous_names":["dislogical/libtlb"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/dislogical/libtlb","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dislogical%2Flibtlb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dislogical%2Flibtlb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dislogical%2Flibtlb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dislogical%2Flibtlb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dislogical","download_url":"https://codeload.github.com/dislogical/libtlb/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dislogical%2Flibtlb/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33962959,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-05T02:00:06.157Z","response_time":120,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":"2025-07-20T13:37:46.377Z","updated_at":"2026-06-05T22:31:27.297Z","avatar_url":"https://github.com/dislogical.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# libtlb\n\nA library for safely balancing event loop handlers across threads.  \n\n## Design\n\nTLB is designed around a single event loop that is blocked on by multiple threads. Thread safety is achieved by setting\nup all subscriptions in oneshot mode (`EPOLLONESHOT` on epoll, `EV_DISPATCH` on kqueue),\nand automatically resubscribing the fd once the user's callback is complete.\nThis means that while one thread is processing an fd, new events will not trigger other threads to wake,\nand thus only one thread may be processing an fd at a time.\n\nGrouped FDs may be setup by subscribing them to a `tlb_evl` instance, and then adding that to the TLB's main loop.\nIn this case, events inside this \"sub loop\" will only be processed by a single thread at any given time.\n\n## API\n\n### TLB\n\n#### `tlb_new`\n\nCreates a new TLB instance.\n\n#### `tlb_destroy`\n\nStops a TLB and throws it into the garbage.\n\n#### `tlb_start`\n\nSpin up the requested number of threads and starts them on waiting on the super loop.\n\n#### `tlb_stop`\n\nStop processing events and spin down all of the threads.\n\n#### `tlb_get_evl`\n\nGet the super loop for the TLB. Use this loop to subscribe things that you would like to receive events for.\n\n## Terminology\n\n| Term | Definition |\n| :--: | :--------- |\n| TLB | The library's primary API. \u003csub\u003e\u003csup\u003eDon't ask what TLB stands for.\u003c/sup\u003e\u003c/sub\u003e |\n| EVL | Event loop (wrapper around epoll or kqueue). |\n| TLB | Main Loop: The event loop that the threads block on. |\n| Sub Loop | An event loop that is not blocked on directly, but rather is subscribed to another event loop. |\n| Super Loop | An event loop that has other event loops subscribed to it. |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdislogical%2Flibtlb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdislogical%2Flibtlb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdislogical%2Flibtlb/lists"}