{"action":"created","issue":{"url":"https://api.github.com/repos/dolphin-emu/dolphin/issues/3989","repository_url":"https://api.github.com/repos/dolphin-emu/dolphin","labels_url":"https://api.github.com/repos/dolphin-emu/dolphin/issues/3989/labels{/name}","comments_url":"https://api.github.com/repos/dolphin-emu/dolphin/issues/3989/comments","events_url":"https://api.github.com/repos/dolphin-emu/dolphin/issues/3989/events","html_url":"https://github.com/dolphin-emu/dolphin/pull/3989","id":164410064,"number":3989,"title":"Don't ScheduleEvent from wrong thread when inserting SD card","user":{"login":"JosJuice","id":6716818,"avatar_url":"https://avatars.githubusercontent.com/u/6716818?v=3","gravatar_id":"","url":"https://api.github.com/users/JosJuice","html_url":"https://github.com/JosJuice","followers_url":"https://api.github.com/users/JosJuice/followers","following_url":"https://api.github.com/users/JosJuice/following{/other_user}","gists_url":"https://api.github.com/users/JosJuice/gists{/gist_id}","starred_url":"https://api.github.com/users/JosJuice/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JosJuice/subscriptions","organizations_url":"https://api.github.com/users/JosJuice/orgs","repos_url":"https://api.github.com/users/JosJuice/repos","events_url":"https://api.github.com/users/JosJuice/events{/privacy}","received_events_url":"https://api.github.com/users/JosJuice/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2016-07-07T21:20:44Z","updated_at":"2016-07-13T06:41:25Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/dolphin-emu/dolphin/pulls/3989","html_url":"https://github.com/dolphin-emu/dolphin/pull/3989","diff_url":"https://github.com/dolphin-emu/dolphin/pull/3989.diff","patch_url":"https://github.com/dolphin-emu/dolphin/pull/3989.patch"},"body":"/dev/sdio/slot0's EventNotify was being called from the UI thread even though it only should be called from the CPU thread for thread safety reasons. With this PR, the UI thread instead schedules an event that will call EventNotify on the CPU thread.\r\n\r\nThere is a potential race condition if IsRunning becomes false right after my newly added call to IsRunning, which can end up adding an event to CoreTiming after it has shut down. It's unlikely to occur in practice, and the old code had the same problem (with GetDeviceByName as the equivalent of IsRunning), but it's still a race condition. I'm not sure what to do about it. Suggestions?\n\n<!-- Reviewable:start -->\n---\nThis change is [<img src=\"https://reviewable.io/review_button.svg\" height=\"34\" align=\"absmiddle\" alt=\"Reviewable\"/>](https://reviewable.io/reviews/dolphin-emu/dolphin/3989)\n<!-- Reviewable:end -->\n"},"comment":{"url":"https://api.github.com/repos/dolphin-emu/dolphin/issues/comments/232269823","html_url":"https://github.com/dolphin-emu/dolphin/pull/3989#issuecomment-232269823","issue_url":"https://api.github.com/repos/dolphin-emu/dolphin/issues/3989","id":232269823,"user":{"login":"phire","id":138484,"avatar_url":"https://avatars.githubusercontent.com/u/138484?v=3","gravatar_id":"","url":"https://api.github.com/users/phire","html_url":"https://github.com/phire","followers_url":"https://api.github.com/users/phire/followers","following_url":"https://api.github.com/users/phire/following{/other_user}","gists_url":"https://api.github.com/users/phire/gists{/gist_id}","starred_url":"https://api.github.com/users/phire/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phire/subscriptions","organizations_url":"https://api.github.com/users/phire/orgs","repos_url":"https://api.github.com/users/phire/repos","events_url":"https://api.github.com/users/phire/events{/privacy}","received_events_url":"https://api.github.com/users/phire/received_events","type":"User","site_admin":false},"created_at":"2016-07-13T06:41:25Z","updated_at":"2016-07-13T06:41:25Z","body":"LGTM"}}
{"actor":{"display_login":"phire"}}