{"id":19036158,"url":"https://github.com/tx7do/test_std_atomic","last_synced_at":"2026-05-05T20:30:19.261Z","repository":{"id":112433750,"uuid":"578855211","full_name":"tx7do/test_std_atomic","owner":"tx7do","description":null,"archived":false,"fork":false,"pushed_at":"2022-12-16T09:50:04.000Z","size":5,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-02T05:32:12.459Z","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/tx7do.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":"2022-12-16T03:19:44.000Z","updated_at":"2022-12-16T05:22:02.000Z","dependencies_parsed_at":"2023-05-15T02:45:12.600Z","dependency_job_id":null,"html_url":"https://github.com/tx7do/test_std_atomic","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/tx7do%2Ftest_std_atomic","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tx7do%2Ftest_std_atomic/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tx7do%2Ftest_std_atomic/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tx7do%2Ftest_std_atomic/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tx7do","download_url":"https://codeload.github.com/tx7do/test_std_atomic/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240093142,"owners_count":19746774,"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-11-08T21:53:37.515Z","updated_at":"2026-05-05T20:30:19.227Z","avatar_url":"https://github.com/tx7do.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 测试std::atomic\r\n\r\n| 类型  | 结果       | 耗时         |\r\n|-----|----------|------------|\r\n| 不加锁 | 无        | 无          |\r\n| 加锁  | 10000000 | 1157.28 ms |\r\n| 原子  | 10000000 | 223.048 ms |\r\n\r\n不加锁根本没有办法完成，Crash了。\r\n\r\n使用原子操作明显比加锁操作要效率高。\r\n\r\n## 参考资料\r\n\r\n- [std::atomic 用法與範例](https://shengyu7697.github.io/std-atomic/)\r\n- [C++11中的原子操作（atomic operation）](https://blog.csdn.net/yockie/article/details/8838686)\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftx7do%2Ftest_std_atomic","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftx7do%2Ftest_std_atomic","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftx7do%2Ftest_std_atomic/lists"}