{"action":"created","comment":{"url":"https://api.github.com/repos/spark/firmware/pulls/comments/50272306","id":50272306,"diff_hunk":"@@ -0,0 +1,37 @@\n+\n+#include \"application.h\"\n+#include \"unit-test/unit-test.h\"\n+\n+test(interrupts_atomic_section)\n+{\n+\t// using SysTick for convenience - we could use a stm32 timer interrupt for a more generic test\n+\t// millis() will not increment while interrupts are disabled.\n+\t// micros() does increment\n+\n+\tuint32_t start_micros = micros();\n+\tuint32_t start_millis, end_millis;\n+\t{\n+\t\tATOMIC_SECTION();\n+\t\tstart_millis = millis();\n+\t\twhile (micros()-start_micros<2000)\n+\t\t{\n+\t\t\t// validates that atomic sections can be nested and interrupts restored when the outermost one exits\n+\t\t\tATOMIC_SECTION();","path":"user/tests/wiring/no_fixture/interrupts.cpp","position":19,"original_position":19,"commit_id":"903ee4a6133a560782b2c61b96d35340c8bf2fba","original_commit_id":"903ee4a6133a560782b2c61b96d35340c8bf2fba","user":{"login":"m-mcgowan","id":2465470,"avatar_url":"https://avatars.githubusercontent.com/u/2465470?v=3","gravatar_id":"","url":"https://api.github.com/users/m-mcgowan","html_url":"https://github.com/m-mcgowan","followers_url":"https://api.github.com/users/m-mcgowan/followers","following_url":"https://api.github.com/users/m-mcgowan/following{/other_user}","gists_url":"https://api.github.com/users/m-mcgowan/gists{/gist_id}","starred_url":"https://api.github.com/users/m-mcgowan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/m-mcgowan/subscriptions","organizations_url":"https://api.github.com/users/m-mcgowan/orgs","repos_url":"https://api.github.com/users/m-mcgowan/repos","events_url":"https://api.github.com/users/m-mcgowan/events{/privacy}","received_events_url":"https://api.github.com/users/m-mcgowan/received_events","type":"User","site_admin":false},"body":"The atomic section will disable interrupts until the end of the section (line 22), so millis() will not increment at all.  The block of code after tries it without atomic and millis() continues incrementing. ","created_at":"2016-01-20T15:53:15Z","updated_at":"2016-01-20T15:53:15Z","html_url":"https://github.com/spark/firmware/pull/824#discussion_r50272306","pull_request_url":"https://api.github.com/repos/spark/firmware/pulls/824","_links":{"self":{"href":"https://api.github.com/repos/spark/firmware/pulls/comments/50272306"},"html":{"href":"https://github.com/spark/firmware/pull/824#discussion_r50272306"},"pull_request":{"href":"https://api.github.com/repos/spark/firmware/pulls/824"}}},"pull_request":{"url":"https://api.github.com/repos/spark/firmware/pulls/824","id":56392368,"html_url":"https://github.com/spark/firmware/pull/824","diff_url":"https://github.com/spark/firmware/pull/824.diff","patch_url":"https://github.com/spark/firmware/pull/824.patch","issue_url":"https://api.github.com/repos/spark/firmware/issues/824","number":824,"state":"open","locked":false,"title":"Feature/criticalsection","user":{"login":"m-mcgowan","id":2465470,"avatar_url":"https://avatars.githubusercontent.com/u/2465470?v=3","gravatar_id":"","url":"https://api.github.com/users/m-mcgowan","html_url":"https://github.com/m-mcgowan","followers_url":"https://api.github.com/users/m-mcgowan/followers","following_url":"https://api.github.com/users/m-mcgowan/following{/other_user}","gists_url":"https://api.github.com/users/m-mcgowan/gists{/gist_id}","starred_url":"https://api.github.com/users/m-mcgowan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/m-mcgowan/subscriptions","organizations_url":"https://api.github.com/users/m-mcgowan/orgs","repos_url":"https://api.github.com/users/m-mcgowan/repos","events_url":"https://api.github.com/users/m-mcgowan/events{/privacy}","received_events_url":"https://api.github.com/users/m-mcgowan/received_events","type":"User","site_admin":false},"body":"SingleThreadeSection and AtomicSection RAII classes. ","created_at":"2016-01-18T21:17:45Z","updated_at":"2016-01-20T15:53:15Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9a5ec2a86fd7b4475c5b65c3c2c1d6657ababf71","assignee":null,"milestone":{"url":"https://api.github.com/repos/spark/firmware/milestones/18","html_url":"https://github.com/spark/firmware/milestones/0.4.9","labels_url":"https://api.github.com/repos/spark/firmware/milestones/18/labels","id":1458242,"number":18,"title":"0.4.9","description":null,"creator":{"login":"m-mcgowan","id":2465470,"avatar_url":"https://avatars.githubusercontent.com/u/2465470?v=3","gravatar_id":"","url":"https://api.github.com/users/m-mcgowan","html_url":"https://github.com/m-mcgowan","followers_url":"https://api.github.com/users/m-mcgowan/followers","following_url":"https://api.github.com/users/m-mcgowan/following{/other_user}","gists_url":"https://api.github.com/users/m-mcgowan/gists{/gist_id}","starred_url":"https://api.github.com/users/m-mcgowan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/m-mcgowan/subscriptions","organizations_url":"https://api.github.com/users/m-mcgowan/orgs","repos_url":"https://api.github.com/users/m-mcgowan/repos","events_url":"https://api.github.com/users/m-mcgowan/events{/privacy}","received_events_url":"https://api.github.com/users/m-mcgowan/received_events","type":"User","site_admin":false},"open_issues":7,"closed_issues":29,"state":"open","created_at":"2015-12-14T00:04:10Z","updated_at":"2016-01-20T15:27:04Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/spark/firmware/pulls/824/commits","review_comments_url":"https://api.github.com/repos/spark/firmware/pulls/824/comments","review_comment_url":"https://api.github.com/repos/spark/firmware/pulls/comments{/number}","comments_url":"https://api.github.com/repos/spark/firmware/issues/824/comments","statuses_url":"https://api.github.com/repos/spark/firmware/statuses/903ee4a6133a560782b2c61b96d35340c8bf2fba","head":{"label":"spark:feature/criticalsection","ref":"feature/criticalsection","sha":"903ee4a6133a560782b2c61b96d35340c8bf2fba","user":{"login":"spark","id":2348966,"avatar_url":"https://avatars.githubusercontent.com/u/2348966?v=3","gravatar_id":"","url":"https://api.github.com/users/spark","html_url":"https://github.com/spark","followers_url":"https://api.github.com/users/spark/followers","following_url":"https://api.github.com/users/spark/following{/other_user}","gists_url":"https://api.github.com/users/spark/gists{/gist_id}","starred_url":"https://api.github.com/users/spark/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spark/subscriptions","organizations_url":"https://api.github.com/users/spark/orgs","repos_url":"https://api.github.com/users/spark/repos","events_url":"https://api.github.com/users/spark/events{/privacy}","received_events_url":"https://api.github.com/users/spark/received_events","type":"Organization","site_admin":false},"repo":{"id":8720130,"name":"firmware","full_name":"spark/firmware","owner":{"login":"spark","id":2348966,"avatar_url":"https://avatars.githubusercontent.com/u/2348966?v=3","gravatar_id":"","url":"https://api.github.com/users/spark","html_url":"https://github.com/spark","followers_url":"https://api.github.com/users/spark/followers","following_url":"https://api.github.com/users/spark/following{/other_user}","gists_url":"https://api.github.com/users/spark/gists{/gist_id}","starred_url":"https://api.github.com/users/spark/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spark/subscriptions","organizations_url":"https://api.github.com/users/spark/orgs","repos_url":"https://api.github.com/users/spark/repos","events_url":"https://api.github.com/users/spark/events{/privacy}","received_events_url":"https://api.github.com/users/spark/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/spark/firmware","description":"Firmware for Particle Devices: Spark Core (master branch) and Photon (latest branch)","fork":false,"url":"https://api.github.com/repos/spark/firmware","forks_url":"https://api.github.com/repos/spark/firmware/forks","keys_url":"https://api.github.com/repos/spark/firmware/keys{/key_id}","collaborators_url":"https://api.github.com/repos/spark/firmware/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/spark/firmware/teams","hooks_url":"https://api.github.com/repos/spark/firmware/hooks","issue_events_url":"https://api.github.com/repos/spark/firmware/issues/events{/number}","events_url":"https://api.github.com/repos/spark/firmware/events","assignees_url":"https://api.github.com/repos/spark/firmware/assignees{/user}","branches_url":"https://api.github.com/repos/spark/firmware/branches{/branch}","tags_url":"https://api.github.com/repos/spark/firmware/tags","blobs_url":"https://api.github.com/repos/spark/firmware/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/spark/firmware/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/spark/firmware/git/refs{/sha}","trees_url":"https://api.github.com/repos/spark/firmware/git/trees{/sha}","statuses_url":"https://api.github.com/repos/spark/firmware/statuses/{sha}","languages_url":"https://api.github.com/repos/spark/firmware/languages","stargazers_url":"https://api.github.com/repos/spark/firmware/stargazers","contributors_url":"https://api.github.com/repos/spark/firmware/contributors","subscribers_url":"https://api.github.com/repos/spark/firmware/subscribers","subscription_url":"https://api.github.com/repos/spark/firmware/subscription","commits_url":"https://api.github.com/repos/spark/firmware/commits{/sha}","git_commits_url":"https://api.github.com/repos/spark/firmware/git/commits{/sha}","comments_url":"https://api.github.com/repos/spark/firmware/comments{/number}","issue_comment_url":"https://api.github.com/repos/spark/firmware/issues/comments{/number}","contents_url":"https://api.github.com/repos/spark/firmware/contents/{+path}","compare_url":"https://api.github.com/repos/spark/firmware/compare/{base}...{head}","merges_url":"https://api.github.com/repos/spark/firmware/merges","archive_url":"https://api.github.com/repos/spark/firmware/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/spark/firmware/downloads","issues_url":"https://api.github.com/repos/spark/firmware/issues{/number}","pulls_url":"https://api.github.com/repos/spark/firmware/pulls{/number}","milestones_url":"https://api.github.com/repos/spark/firmware/milestones{/number}","notifications_url":"https://api.github.com/repos/spark/firmware/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/spark/firmware/labels{/name}","releases_url":"https://api.github.com/repos/spark/firmware/releases{/id}","created_at":"2013-03-12T04:42:33Z","updated_at":"2016-01-20T13:27:44Z","pushed_at":"2016-01-20T14:42:57Z","git_url":"git://github.com/spark/firmware.git","ssh_url":"git@github.com:spark/firmware.git","clone_url":"https://github.com/spark/firmware.git","svn_url":"https://github.com/spark/firmware","homepage":"https://www.particle.io/","size":104838,"stargazers_count":407,"watchers_count":407,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":281,"mirror_url":null,"open_issues_count":86,"forks":281,"open_issues":86,"watchers":407,"default_branch":"develop"}},"base":{"label":"spark:develop","ref":"develop","sha":"6624fdbb424a52df003d394d944c5e4bba7fde5c","user":{"login":"spark","id":2348966,"avatar_url":"https://avatars.githubusercontent.com/u/2348966?v=3","gravatar_id":"","url":"https://api.github.com/users/spark","html_url":"https://github.com/spark","followers_url":"https://api.github.com/users/spark/followers","following_url":"https://api.github.com/users/spark/following{/other_user}","gists_url":"https://api.github.com/users/spark/gists{/gist_id}","starred_url":"https://api.github.com/users/spark/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spark/subscriptions","organizations_url":"https://api.github.com/users/spark/orgs","repos_url":"https://api.github.com/users/spark/repos","events_url":"https://api.github.com/users/spark/events{/privacy}","received_events_url":"https://api.github.com/users/spark/received_events","type":"Organization","site_admin":false},"repo":{"id":8720130,"name":"firmware","full_name":"spark/firmware","owner":{"login":"spark","id":2348966,"avatar_url":"https://avatars.githubusercontent.com/u/2348966?v=3","gravatar_id":"","url":"https://api.github.com/users/spark","html_url":"https://github.com/spark","followers_url":"https://api.github.com/users/spark/followers","following_url":"https://api.github.com/users/spark/following{/other_user}","gists_url":"https://api.github.com/users/spark/gists{/gist_id}","starred_url":"https://api.github.com/users/spark/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spark/subscriptions","organizations_url":"https://api.github.com/users/spark/orgs","repos_url":"https://api.github.com/users/spark/repos","events_url":"https://api.github.com/users/spark/events{/privacy}","received_events_url":"https://api.github.com/users/spark/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/spark/firmware","description":"Firmware for Particle Devices: Spark Core (master branch) and Photon (latest branch)","fork":false,"url":"https://api.github.com/repos/spark/firmware","forks_url":"https://api.github.com/repos/spark/firmware/forks","keys_url":"https://api.github.com/repos/spark/firmware/keys{/key_id}","collaborators_url":"https://api.github.com/repos/spark/firmware/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/spark/firmware/teams","hooks_url":"https://api.github.com/repos/spark/firmware/hooks","issue_events_url":"https://api.github.com/repos/spark/firmware/issues/events{/number}","events_url":"https://api.github.com/repos/spark/firmware/events","assignees_url":"https://api.github.com/repos/spark/firmware/assignees{/user}","branches_url":"https://api.github.com/repos/spark/firmware/branches{/branch}","tags_url":"https://api.github.com/repos/spark/firmware/tags","blobs_url":"https://api.github.com/repos/spark/firmware/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/spark/firmware/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/spark/firmware/git/refs{/sha}","trees_url":"https://api.github.com/repos/spark/firmware/git/trees{/sha}","statuses_url":"https://api.github.com/repos/spark/firmware/statuses/{sha}","languages_url":"https://api.github.com/repos/spark/firmware/languages","stargazers_url":"https://api.github.com/repos/spark/firmware/stargazers","contributors_url":"https://api.github.com/repos/spark/firmware/contributors","subscribers_url":"https://api.github.com/repos/spark/firmware/subscribers","subscription_url":"https://api.github.com/repos/spark/firmware/subscription","commits_url":"https://api.github.com/repos/spark/firmware/commits{/sha}","git_commits_url":"https://api.github.com/repos/spark/firmware/git/commits{/sha}","comments_url":"https://api.github.com/repos/spark/firmware/comments{/number}","issue_comment_url":"https://api.github.com/repos/spark/firmware/issues/comments{/number}","contents_url":"https://api.github.com/repos/spark/firmware/contents/{+path}","compare_url":"https://api.github.com/repos/spark/firmware/compare/{base}...{head}","merges_url":"https://api.github.com/repos/spark/firmware/merges","archive_url":"https://api.github.com/repos/spark/firmware/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/spark/firmware/downloads","issues_url":"https://api.github.com/repos/spark/firmware/issues{/number}","pulls_url":"https://api.github.com/repos/spark/firmware/pulls{/number}","milestones_url":"https://api.github.com/repos/spark/firmware/milestones{/number}","notifications_url":"https://api.github.com/repos/spark/firmware/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/spark/firmware/labels{/name}","releases_url":"https://api.github.com/repos/spark/firmware/releases{/id}","created_at":"2013-03-12T04:42:33Z","updated_at":"2016-01-20T13:27:44Z","pushed_at":"2016-01-20T14:42:57Z","git_url":"git://github.com/spark/firmware.git","ssh_url":"git@github.com:spark/firmware.git","clone_url":"https://github.com/spark/firmware.git","svn_url":"https://github.com/spark/firmware","homepage":"https://www.particle.io/","size":104838,"stargazers_count":407,"watchers_count":407,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":281,"mirror_url":null,"open_issues_count":86,"forks":281,"open_issues":86,"watchers":407,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/spark/firmware/pulls/824"},"html":{"href":"https://github.com/spark/firmware/pull/824"},"issue":{"href":"https://api.github.com/repos/spark/firmware/issues/824"},"comments":{"href":"https://api.github.com/repos/spark/firmware/issues/824/comments"},"review_comments":{"href":"https://api.github.com/repos/spark/firmware/pulls/824/comments"},"review_comment":{"href":"https://api.github.com/repos/spark/firmware/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/spark/firmware/pulls/824/commits"},"statuses":{"href":"https://api.github.com/repos/spark/firmware/statuses/903ee4a6133a560782b2c61b96d35340c8bf2fba"}}}}