{"action":"created","comment":{"url":"https://api.github.com/repos/factor/factor/pulls/comments/65345733","id":65345733,"diff_hunk":"@@ -304,6 +304,54 @@ void handle_ctrl_c() {\n   SetConsoleCtrlHandler(factor::ctrl_handler, TRUE);\n }\n \n+static volatile bool stop_on_ctrl_break = false;\n+static HANDLE ctrl_break_thread = NULL;\n+\n+static DWORD WINAPI ctrl_break_thread_proc(LPVOID mainThread) {\n+  bool ctrl_break_handled = false;\n+  while (true) {\n+    if (factor::stop_on_ctrl_break) {\n+      if (GetAsyncKeyState(VK_CANCEL) >= 0) { /* Ctrl-Break is released. */\n+        ctrl_break_handled = false;  /* Wait for the next press. */\n+      } else if (!ctrl_break_handled) {\n+        /* This proc runs in its own thread without stopping the main\n+           thread. Since in practice nobody uses the multi-VM stuff yet,\n+           we just interrupt the first VM we can get. */\n+        FACTOR_ASSERT(thread_vms.size() > 0);\n+        THREADHANDLE thd = thread_vms.begin()->first;\n+        factor_vm* vm = thread_vms.begin()->second;\n+        /* Check if the VM thread has the same Id as the thread Id of the\n+           currently active window. Note that thread Id is not a handle. */\n+        DWORD fgThreadId = GetWindowThreadProcessId(GetForegroundWindow(),\n+                                                    NULL);\n+        if (!atomic::load(&vm->safepoint.fep_p)\n+            && (fgThreadId == vm->thread_id)\n+        ) {\n+          atomic::store(&vm->skip_debugger_p, true);\n+          vm->safepoint.enqueue_fep(vm);\n+          wake_up_thread(thd); /* Try to wake up the thread. */\n+          ctrl_break_handled = true;\n+        }\n+      }\n+    }\n+    Sleep(100);\n+  }","path":"vm/os-windows.cpp","position":35,"original_position":35,"commit_id":"4d02dba3763eaf6bf0ce63afe570647003cece45","original_commit_id":"4d02dba3763eaf6bf0ce63afe570647003cece45","user":{"login":"bjourne","id":142475,"avatar_url":"https://avatars.githubusercontent.com/u/142475?v=3","gravatar_id":"","url":"https://api.github.com/users/bjourne","html_url":"https://github.com/bjourne","followers_url":"https://api.github.com/users/bjourne/followers","following_url":"https://api.github.com/users/bjourne/following{/other_user}","gists_url":"https://api.github.com/users/bjourne/gists{/gist_id}","starred_url":"https://api.github.com/users/bjourne/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bjourne/subscriptions","organizations_url":"https://api.github.com/users/bjourne/orgs","repos_url":"https://api.github.com/users/bjourne/repos","events_url":"https://api.github.com/users/bjourne/events{/privacy}","received_events_url":"https://api.github.com/users/bjourne/received_events","type":"User","site_admin":false},"body":"Now I've experimented a lot and 100 ms makes to many ctrl+break presses get lost on my machine. If it doesn't affect performance 30 ms or less would be a better polling interval.","created_at":"2016-06-01T11:50:21Z","updated_at":"2016-06-01T11:50:21Z","html_url":"https://github.com/factor/factor/pull/1638#discussion_r65345733","pull_request_url":"https://api.github.com/repos/factor/factor/pulls/1638","_links":{"self":{"href":"https://api.github.com/repos/factor/factor/pulls/comments/65345733"},"html":{"href":"https://github.com/factor/factor/pull/1638#discussion_r65345733"},"pull_request":{"href":"https://api.github.com/repos/factor/factor/pulls/1638"}}},"pull_request":{"url":"https://api.github.com/repos/factor/factor/pulls/1638","id":71813082,"html_url":"https://github.com/factor/factor/pull/1638","diff_url":"https://github.com/factor/factor/pull/1638.diff","patch_url":"https://github.com/factor/factor/pull/1638.patch","issue_url":"https://api.github.com/repos/factor/factor/issues/1638","number":1638,"state":"open","locked":false,"title":"Fix 1573 (ctrl-break interrupt loops)","user":{"login":"AlexIljin","id":169039,"avatar_url":"https://avatars.githubusercontent.com/u/169039?v=3","gravatar_id":"","url":"https://api.github.com/users/AlexIljin","html_url":"https://github.com/AlexIljin","followers_url":"https://api.github.com/users/AlexIljin/followers","following_url":"https://api.github.com/users/AlexIljin/following{/other_user}","gists_url":"https://api.github.com/users/AlexIljin/gists{/gist_id}","starred_url":"https://api.github.com/users/AlexIljin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlexIljin/subscriptions","organizations_url":"https://api.github.com/users/AlexIljin/orgs","repos_url":"https://api.github.com/users/AlexIljin/repos","events_url":"https://api.github.com/users/AlexIljin/events{/privacy}","received_events_url":"https://api.github.com/users/AlexIljin/received_events","type":"User","site_admin":false},"body":"This is a draft implementation of the fix.","created_at":"2016-05-28T22:26:44Z","updated_at":"2016-06-01T11:50:21Z","closed_at":null,"merged_at":null,"merge_commit_sha":"fcdab560704230990f2cf40f498c2fa95f34c687","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/factor/factor/pulls/1638/commits","review_comments_url":"https://api.github.com/repos/factor/factor/pulls/1638/comments","review_comment_url":"https://api.github.com/repos/factor/factor/pulls/comments{/number}","comments_url":"https://api.github.com/repos/factor/factor/issues/1638/comments","statuses_url":"https://api.github.com/repos/factor/factor/statuses/4d02dba3763eaf6bf0ce63afe570647003cece45","head":{"label":"AlexIljin:fix-1573","ref":"fix-1573","sha":"4d02dba3763eaf6bf0ce63afe570647003cece45","user":{"login":"AlexIljin","id":169039,"avatar_url":"https://avatars.githubusercontent.com/u/169039?v=3","gravatar_id":"","url":"https://api.github.com/users/AlexIljin","html_url":"https://github.com/AlexIljin","followers_url":"https://api.github.com/users/AlexIljin/followers","following_url":"https://api.github.com/users/AlexIljin/following{/other_user}","gists_url":"https://api.github.com/users/AlexIljin/gists{/gist_id}","starred_url":"https://api.github.com/users/AlexIljin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlexIljin/subscriptions","organizations_url":"https://api.github.com/users/AlexIljin/orgs","repos_url":"https://api.github.com/users/AlexIljin/repos","events_url":"https://api.github.com/users/AlexIljin/events{/privacy}","received_events_url":"https://api.github.com/users/AlexIljin/received_events","type":"User","site_admin":false},"repo":{"id":55908464,"name":"factor","full_name":"AlexIljin/factor","owner":{"login":"AlexIljin","id":169039,"avatar_url":"https://avatars.githubusercontent.com/u/169039?v=3","gravatar_id":"","url":"https://api.github.com/users/AlexIljin","html_url":"https://github.com/AlexIljin","followers_url":"https://api.github.com/users/AlexIljin/followers","following_url":"https://api.github.com/users/AlexIljin/following{/other_user}","gists_url":"https://api.github.com/users/AlexIljin/gists{/gist_id}","starred_url":"https://api.github.com/users/AlexIljin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlexIljin/subscriptions","organizations_url":"https://api.github.com/users/AlexIljin/orgs","repos_url":"https://api.github.com/users/AlexIljin/repos","events_url":"https://api.github.com/users/AlexIljin/events{/privacy}","received_events_url":"https://api.github.com/users/AlexIljin/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/AlexIljin/factor","description":"Factor programming language - Github mirror of official GIT repo","fork":true,"url":"https://api.github.com/repos/AlexIljin/factor","forks_url":"https://api.github.com/repos/AlexIljin/factor/forks","keys_url":"https://api.github.com/repos/AlexIljin/factor/keys{/key_id}","collaborators_url":"https://api.github.com/repos/AlexIljin/factor/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/AlexIljin/factor/teams","hooks_url":"https://api.github.com/repos/AlexIljin/factor/hooks","issue_events_url":"https://api.github.com/repos/AlexIljin/factor/issues/events{/number}","events_url":"https://api.github.com/repos/AlexIljin/factor/events","assignees_url":"https://api.github.com/repos/AlexIljin/factor/assignees{/user}","branches_url":"https://api.github.com/repos/AlexIljin/factor/branches{/branch}","tags_url":"https://api.github.com/repos/AlexIljin/factor/tags","blobs_url":"https://api.github.com/repos/AlexIljin/factor/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/AlexIljin/factor/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/AlexIljin/factor/git/refs{/sha}","trees_url":"https://api.github.com/repos/AlexIljin/factor/git/trees{/sha}","statuses_url":"https://api.github.com/repos/AlexIljin/factor/statuses/{sha}","languages_url":"https://api.github.com/repos/AlexIljin/factor/languages","stargazers_url":"https://api.github.com/repos/AlexIljin/factor/stargazers","contributors_url":"https://api.github.com/repos/AlexIljin/factor/contributors","subscribers_url":"https://api.github.com/repos/AlexIljin/factor/subscribers","subscription_url":"https://api.github.com/repos/AlexIljin/factor/subscription","commits_url":"https://api.github.com/repos/AlexIljin/factor/commits{/sha}","git_commits_url":"https://api.github.com/repos/AlexIljin/factor/git/commits{/sha}","comments_url":"https://api.github.com/repos/AlexIljin/factor/comments{/number}","issue_comment_url":"https://api.github.com/repos/AlexIljin/factor/issues/comments{/number}","contents_url":"https://api.github.com/repos/AlexIljin/factor/contents/{+path}","compare_url":"https://api.github.com/repos/AlexIljin/factor/compare/{base}...{head}","merges_url":"https://api.github.com/repos/AlexIljin/factor/merges","archive_url":"https://api.github.com/repos/AlexIljin/factor/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/AlexIljin/factor/downloads","issues_url":"https://api.github.com/repos/AlexIljin/factor/issues{/number}","pulls_url":"https://api.github.com/repos/AlexIljin/factor/pulls{/number}","milestones_url":"https://api.github.com/repos/AlexIljin/factor/milestones{/number}","notifications_url":"https://api.github.com/repos/AlexIljin/factor/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/AlexIljin/factor/labels{/name}","releases_url":"https://api.github.com/repos/AlexIljin/factor/releases{/id}","deployments_url":"https://api.github.com/repos/AlexIljin/factor/deployments","created_at":"2016-04-10T15:58:27Z","updated_at":"2016-04-10T15:58:41Z","pushed_at":"2016-05-31T20:14:51Z","git_url":"git://github.com/AlexIljin/factor.git","ssh_url":"git@github.com:AlexIljin/factor.git","clone_url":"https://github.com/AlexIljin/factor.git","svn_url":"https://github.com/AlexIljin/factor","homepage":"https://factorcode.org/","size":101986,"stargazers_count":0,"watchers_count":0,"language":"Factor","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"factor:master","ref":"master","sha":"8e2a65e5a2b9c3f7d529bdd3381b731713811fdc","user":{"login":"factor","id":232051,"avatar_url":"https://avatars.githubusercontent.com/u/232051?v=3","gravatar_id":"","url":"https://api.github.com/users/factor","html_url":"https://github.com/factor","followers_url":"https://api.github.com/users/factor/followers","following_url":"https://api.github.com/users/factor/following{/other_user}","gists_url":"https://api.github.com/users/factor/gists{/gist_id}","starred_url":"https://api.github.com/users/factor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/factor/subscriptions","organizations_url":"https://api.github.com/users/factor/orgs","repos_url":"https://api.github.com/users/factor/repos","events_url":"https://api.github.com/users/factor/events{/privacy}","received_events_url":"https://api.github.com/users/factor/received_events","type":"Organization","site_admin":false},"repo":{"id":157985,"name":"factor","full_name":"factor/factor","owner":{"login":"factor","id":232051,"avatar_url":"https://avatars.githubusercontent.com/u/232051?v=3","gravatar_id":"","url":"https://api.github.com/users/factor","html_url":"https://github.com/factor","followers_url":"https://api.github.com/users/factor/followers","following_url":"https://api.github.com/users/factor/following{/other_user}","gists_url":"https://api.github.com/users/factor/gists{/gist_id}","starred_url":"https://api.github.com/users/factor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/factor/subscriptions","organizations_url":"https://api.github.com/users/factor/orgs","repos_url":"https://api.github.com/users/factor/repos","events_url":"https://api.github.com/users/factor/events{/privacy}","received_events_url":"https://api.github.com/users/factor/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/factor/factor","description":"Factor programming language - Github mirror of official GIT repo","fork":false,"url":"https://api.github.com/repos/factor/factor","forks_url":"https://api.github.com/repos/factor/factor/forks","keys_url":"https://api.github.com/repos/factor/factor/keys{/key_id}","collaborators_url":"https://api.github.com/repos/factor/factor/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/factor/factor/teams","hooks_url":"https://api.github.com/repos/factor/factor/hooks","issue_events_url":"https://api.github.com/repos/factor/factor/issues/events{/number}","events_url":"https://api.github.com/repos/factor/factor/events","assignees_url":"https://api.github.com/repos/factor/factor/assignees{/user}","branches_url":"https://api.github.com/repos/factor/factor/branches{/branch}","tags_url":"https://api.github.com/repos/factor/factor/tags","blobs_url":"https://api.github.com/repos/factor/factor/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/factor/factor/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/factor/factor/git/refs{/sha}","trees_url":"https://api.github.com/repos/factor/factor/git/trees{/sha}","statuses_url":"https://api.github.com/repos/factor/factor/statuses/{sha}","languages_url":"https://api.github.com/repos/factor/factor/languages","stargazers_url":"https://api.github.com/repos/factor/factor/stargazers","contributors_url":"https://api.github.com/repos/factor/factor/contributors","subscribers_url":"https://api.github.com/repos/factor/factor/subscribers","subscription_url":"https://api.github.com/repos/factor/factor/subscription","commits_url":"https://api.github.com/repos/factor/factor/commits{/sha}","git_commits_url":"https://api.github.com/repos/factor/factor/git/commits{/sha}","comments_url":"https://api.github.com/repos/factor/factor/comments{/number}","issue_comment_url":"https://api.github.com/repos/factor/factor/issues/comments{/number}","contents_url":"https://api.github.com/repos/factor/factor/contents/{+path}","compare_url":"https://api.github.com/repos/factor/factor/compare/{base}...{head}","merges_url":"https://api.github.com/repos/factor/factor/merges","archive_url":"https://api.github.com/repos/factor/factor/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/factor/factor/downloads","issues_url":"https://api.github.com/repos/factor/factor/issues{/number}","pulls_url":"https://api.github.com/repos/factor/factor/pulls{/number}","milestones_url":"https://api.github.com/repos/factor/factor/milestones{/number}","notifications_url":"https://api.github.com/repos/factor/factor/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/factor/factor/labels{/name}","releases_url":"https://api.github.com/repos/factor/factor/releases{/id}","deployments_url":"https://api.github.com/repos/factor/factor/deployments","created_at":"2009-03-24T13:17:48Z","updated_at":"2016-05-26T17:27:23Z","pushed_at":"2016-05-31T20:17:56Z","git_url":"git://github.com/factor/factor.git","ssh_url":"git@github.com:factor/factor.git","clone_url":"https://github.com/factor/factor.git","svn_url":"https://github.com/factor/factor","homepage":"https://factorcode.org/","size":155618,"stargazers_count":469,"watchers_count":469,"language":"Factor","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":97,"mirror_url":null,"open_issues_count":453,"forks":97,"open_issues":453,"watchers":469,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/factor/factor/pulls/1638"},"html":{"href":"https://github.com/factor/factor/pull/1638"},"issue":{"href":"https://api.github.com/repos/factor/factor/issues/1638"},"comments":{"href":"https://api.github.com/repos/factor/factor/issues/1638/comments"},"review_comments":{"href":"https://api.github.com/repos/factor/factor/pulls/1638/comments"},"review_comment":{"href":"https://api.github.com/repos/factor/factor/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/factor/factor/pulls/1638/commits"},"statuses":{"href":"https://api.github.com/repos/factor/factor/statuses/4d02dba3763eaf6bf0ce63afe570647003cece45"}}}}
{"actor":{"display_login":"bjourne"}}