{"action":"created","issue":{"url":"https://api.github.com/repos/Metaswitch/cpp-common/issues/470","repository_url":"https://api.github.com/repos/Metaswitch/cpp-common","labels_url":"https://api.github.com/repos/Metaswitch/cpp-common/issues/470/labels{/name}","comments_url":"https://api.github.com/repos/Metaswitch/cpp-common/issues/470/comments","events_url":"https://api.github.com/repos/Metaswitch/cpp-common/issues/470/events","html_url":"https://github.com/Metaswitch/cpp-common/pull/470","id":139422863,"number":470,"title":"Reviewer Rob - Create the alarm_resend thread lazily","user":{"login":"bossmc","id":1073983,"avatar_url":"https://avatars.githubusercontent.com/u/1073983?v=3","gravatar_id":"","url":"https://api.github.com/users/bossmc","html_url":"https://github.com/bossmc","followers_url":"https://api.github.com/users/bossmc/followers","following_url":"https://api.github.com/users/bossmc/following{/other_user}","gists_url":"https://api.github.com/users/bossmc/gists{/gist_id}","starred_url":"https://api.github.com/users/bossmc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bossmc/subscriptions","organizations_url":"https://api.github.com/users/bossmc/orgs","repos_url":"https://api.github.com/users/bossmc/repos","events_url":"https://api.github.com/users/bossmc/events{/privacy}","received_events_url":"https://api.github.com/users/bossmc/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"bossmc","id":1073983,"avatar_url":"https://avatars.githubusercontent.com/u/1073983?v=3","gravatar_id":"","url":"https://api.github.com/users/bossmc","html_url":"https://github.com/bossmc","followers_url":"https://api.github.com/users/bossmc/followers","following_url":"https://api.github.com/users/bossmc/following{/other_user}","gists_url":"https://api.github.com/users/bossmc/gists{/gist_id}","starred_url":"https://api.github.com/users/bossmc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bossmc/subscriptions","organizations_url":"https://api.github.com/users/bossmc/orgs","repos_url":"https://api.github.com/users/bossmc/repos","events_url":"https://api.github.com/users/bossmc/events{/privacy}","received_events_url":"https://api.github.com/users/bossmc/received_events","type":"User","site_admin":false},"milestone":null,"comments":2,"created_at":"2016-03-08T23:15:51Z","updated_at":"2016-03-09T09:04:14Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/Metaswitch/cpp-common/pulls/470","html_url":"https://github.com/Metaswitch/cpp-common/pull/470","diff_url":"https://github.com/Metaswitch/cpp-common/pull/470.diff","patch_url":"https://github.com/Metaswitch/cpp-common/pull/470.patch"},"body":"Don't spawn threads in things created statically, instead spawn the thread lazily the first time someone calls into `AlarmManager::get_instance()` which happens (among other times) when alarms are defined.  This means you should always wait until after demonizing/forking before defining alarms but this is a pretty reasonable requirement.\r\n\r\nAlso fixed up a locking mistake (we weren't protecting access to the list of registered alarms even though we iterate over the list in another thread).\r\n\r\nTesting done:\r\n\r\n- [x] UTs\r\n- [ ] Clearwater Live Test - Doesn't test alarms\r\n- [x] Manual live verification - Tested that alarms are still raised as expected and that the resync thread is running (checked in `gdb`)"},"comment":{"url":"https://api.github.com/repos/Metaswitch/cpp-common/issues/comments/194192405","html_url":"https://github.com/Metaswitch/cpp-common/pull/470#issuecomment-194192405","issue_url":"https://api.github.com/repos/Metaswitch/cpp-common/issues/470","id":194192405,"user":{"login":"rkd-msw","id":4363492,"avatar_url":"https://avatars.githubusercontent.com/u/4363492?v=3","gravatar_id":"","url":"https://api.github.com/users/rkd-msw","html_url":"https://github.com/rkd-msw","followers_url":"https://api.github.com/users/rkd-msw/followers","following_url":"https://api.github.com/users/rkd-msw/following{/other_user}","gists_url":"https://api.github.com/users/rkd-msw/gists{/gist_id}","starred_url":"https://api.github.com/users/rkd-msw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rkd-msw/subscriptions","organizations_url":"https://api.github.com/users/rkd-msw/orgs","repos_url":"https://api.github.com/users/rkd-msw/repos","events_url":"https://api.github.com/users/rkd-msw/events{/privacy}","received_events_url":"https://api.github.com/users/rkd-msw/received_events","type":"User","site_admin":false},"created_at":"2016-03-09T09:04:14Z","updated_at":"2016-03-09T09:04:14Z","body":"Also also, seeing the locking mistake makes me think we should be running more of our stuff under Helgrind to catch this, but I'll have a think about that."}}