{"id":20381727,"url":"https://github.com/jacob-c-smith/sync","last_synced_at":"2026-02-22T14:15:15.137Z","repository":{"id":178218214,"uuid":"661523996","full_name":"Jacob-C-Smith/sync","owner":"Jacob-C-Smith","description":"Cross platform synchronization primitives and high-precision timing","archived":false,"fork":false,"pushed_at":"2024-12-27T20:50:28.000Z","size":33,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-12-27T21:27:52.645Z","etag":null,"topics":["c","synchronization"],"latest_commit_sha":null,"homepage":"https://g10.app/status/#primitives","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/Jacob-C-Smith.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}},"created_at":"2023-07-03T04:23:51.000Z","updated_at":"2024-12-27T20:50:31.000Z","dependencies_parsed_at":"2023-12-19T04:17:26.099Z","dependency_job_id":"e125fdcc-f9b1-4c3d-9350-5e718582741f","html_url":"https://github.com/Jacob-C-Smith/sync","commit_stats":null,"previous_names":["jacob-c-smith/sync"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jacob-C-Smith%2Fsync","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jacob-C-Smith%2Fsync/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jacob-C-Smith%2Fsync/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jacob-C-Smith%2Fsync/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Jacob-C-Smith","download_url":"https://codeload.github.com/Jacob-C-Smith/sync/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234001687,"owners_count":18764310,"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":["c","synchronization"],"created_at":"2024-11-15T02:15:07.375Z","updated_at":"2025-09-23T21:31:52.209Z","avatar_url":"https://github.com/Jacob-C-Smith.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# sync \n\n[![sync](https://github.com/Jacob-C-Smith/sync/actions/workflows/cmake.yml/badge.svg)](https://github.com/Jacob-C-Smith/sync/actions/workflows/cmake.yml)\n \n Cross platform synchronization primatives and high precision timestamps\n\n \u003e 0 [Try it](#try-it)\n \u003e\n \u003e 1 [Download](#download)\n \u003e\n \u003e 2 [Build](#build)\n \u003e\n \u003e 3 [Example](#example)\n \u003e\n \u003e\u003e 3.1 [Example output](#example-output)\n \u003e\n \u003e 4 [Definitions](#definitions)\n \u003e\n \u003e\u003e 4.1 [Type definitions](#type-definitions)\n \u003e\u003e\n \u003e\u003e 4.2 [Function definitions](#function-definitions)\n\n## Try it\n[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/Jacob-C-Smith/sync?quickstart=1)\n\nWait for a few moments, then click the play button on the bottom of the window. This will run the example program.\n\n ## Download\n To download sync, execute the following command\n ```bash\n $ git clone https://github.com/Jacob-C-Smith/sync\n ```\n ## Build\n To build on UNIX like machines, execute the following commands in the same directory\n ```bash\n $ cd sync\n $ cmake .\n $ make\n ```\n  This will build the example program, the tester program, and dynamic / shared libraries\n\n  To build sync for Windows machines, open the base directory in Visual Studio, and build your desired target(s)\n ## Example\n To run the example program, execute this command\n ```\n $ ./sync_example\n ```\n ### Example output\n [ NONE ]\n\n [Source](main.c) \n ## Definitions\n ### Type definitions\n ```c\n typedef ... mutex;\n typedef ... rwlock;\n typedef ... spinlock;\n typedef ... semaphore;\n\n typedef ... condition_variable;\n typedef ... monitor;\n typedef ... barrier;\n\n typedef signed timestamp;\n ```\n *NOTE: mutex and semaphore definitions are platform dependent*\n ### Function definitions\n ```c \n // Initializer\nvoid sync_init ( void ) __attribute__((constructor));\n\n// Timer\ntimestamp timer_high_precision  ( void );\nsigned    timer_seconds_divisor ( void );\n\n// Mutex\nint mutex_create  ( mutex *p_mutex );\nint mutex_lock    ( mutex *p_mutex );\nint mutex_unlock  ( mutex *p_mutex );\nint mutex_destroy ( mutex *p_mutex );\n\n// Spinlock\nint spinlock_create  ( spinlock *p_spinlock );\nint spinlock_lock    ( spinlock *p_spinlock );\nint spinlock_unlock  ( spinlock *p_spinlock );\nint spinlock_destroy ( spinlock *p_spinlock );\n\n// Read Write Lock\nint rwlock_create          ( rwlock *p_rwlock );\nint rwlock_lock_rd         ( rwlock *p_rwlock );\nint rwlock_lock_wr         ( rwlock *p_rwlock );\nint rwlock_lock_timeout_rd ( rwlock *p_rwlock, timestamp _time );\nint rwlock_lock_timeout_wr ( rwlock *p_rwlock, timestamp _time );\nint rwlock_unlock          ( rwlock *p_rwlock );\nint rwlock_destroy         ( rwlock *p_rwlock );\n\n// Semaphore\nint semaphore_create  ( semaphore *p_semaphore, unsigned int count );\nint semaphore_wait    ( semaphore _semaphore );\nint semaphore_signal  ( semaphore _semaphore );\nint semaphore_destroy ( semaphore *p_semaphore );\n\n// Condition variable\nint condition_variable_create       ( condition_variable *p_condition_variable );\nint condition_variable_wait         ( condition_variable *p_condition_variable, mutex *p_mutex );\nint condition_variable_wait_timeout ( condition_variable *p_condition_variable, mutex *p_mutex, timestamp _time );\nint condition_variable_signal       ( condition_variable *const p_condition_variable );\nint condition_variable_broadcast    ( condition_variable *const p_condition_variable );\nint condition_variable_destroy      ( condition_variable *p_condition_variable );\n\n// Monitor\nint monitor_create     ( monitor *p_monitor );\nint monitor_wait       ( monitor *p_monitor );\nint monitor_notify     ( monitor *p_monitor );\nint monitor_notify_all ( monitor *p_monitor );\nint monitor_destroy    ( monitor *p_monitor );\n\n// Barrier\nint barrier_create  ( barrier *p_barrier, int count );\nint barrier_wait    ( barrier *p_barrier );\nint barrier_destroy ( barrier *p_barrier );\n\n// Cleanup\nvoid sync_exit ( void ) __attribute__((destructor));\n ```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjacob-c-smith%2Fsync","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjacob-c-smith%2Fsync","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjacob-c-smith%2Fsync/lists"}