{"id":13730154,"url":"https://github.com/Bosma/Scheduler","last_synced_at":"2025-05-08T02:31:26.361Z","repository":{"id":20435190,"uuid":"89825157","full_name":"Bosma/Scheduler","owner":"Bosma","description":"Modern C++ Scheduling Library","archived":false,"fork":false,"pushed_at":"2022-01-08T06:23:43.000Z","size":30,"stargazers_count":274,"open_issues_count":15,"forks_count":76,"subscribers_count":14,"default_branch":"master","last_synced_at":"2024-11-14T20:39:42.605Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/Bosma.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}},"created_at":"2017-04-30T02:38:04.000Z","updated_at":"2024-10-26T07:00:14.000Z","dependencies_parsed_at":"2022-07-26T09:17:47.623Z","dependency_job_id":null,"html_url":"https://github.com/Bosma/Scheduler","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bosma%2FScheduler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bosma%2FScheduler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bosma%2FScheduler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bosma%2FScheduler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Bosma","download_url":"https://codeload.github.com/Bosma/Scheduler/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252986757,"owners_count":21836218,"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-08-03T02:01:10.670Z","updated_at":"2025-05-08T02:31:26.076Z","avatar_url":"https://github.com/Bosma.png","language":"C++","readme":"# Scheduler\nModern C++ Header-Only Scheduling Library. Tasks run in thread pool. Requires C++11 and [ctpl_stl.h](https://github.com/vit-vit/CTPL) in the path.\n\nInspired by the [Rufus-Scheduler](https://github.com/jmettraux/rufus-scheduler) gem. Offers mostly the same functionality.\n\n```C++\n  #include \"Scheduler.h\"\n\n  // number of tasks that can run simultaneously\n  // Note: not the number of tasks that can be added,\n  //       but number of tasks that can be run in parallel\n  unsigned int max_n_threads = 12;\n\n  // Make a new scheduling object.\n  // Note: s cannot be moved or copied\n  Bosma::Scheduler s(max_n_threads);\n\n  // every second call message(\"every second\")\n  s.every(1s, message, \"every second\");\n\n  // in one minute\n  s.in(1min, []() { std::cout \u003c\u003c \"in one minute\" \u003c\u003c std::endl; });\n\n  // in one second run lambda, then wait a second, run lambda, and so on\n  // different from every in that multiple instances of the function will not be run concurrently\n  s.interval(1s, []() {\n    std::this_thread::sleep_for(5s);\n    std::cout \u003c\u003c \"once every 6s\" \u003c\u003c std::endl;\n  });\n\n  s.every(1min, []() { std::cout \u003c\u003c \"every minute\" \u003c\u003c std::endl; });\n\n  // https://en.wikipedia.org/wiki/Cron\n  s.cron(\"* * * * *\", []() { std::cout \u003c\u003c \"top of every minute\" \u003c\u003c std::endl; });\n\n  // Time formats supported:\n  // %Y/%m/%d %H:%M:%S, %Y-%m-%d %H:%M:%S, %H:%M:%S\n  // With only a time given, it will run tomorrow if that time has already passed.\n  // But with a date given, it will run immediately if that time has already passed.\n  s.at(\"2017-04-19 12:31:15\", []() { std::cout \u003c\u003c \"at a specific time.\" \u003c\u003c std::endl; });\n\n  s.cron(\"5 0 * * *\", []() { std::cout \u003c\u003c \"every day 5 minutes after midnight\" \u003c\u003c std::endl; });\n```\nSee [example.cpp](example.cpp) for a full example.\n","funding_links":[],"categories":["C++"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FBosma%2FScheduler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FBosma%2FScheduler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FBosma%2FScheduler/lists"}