{"action":"created","issue":{"url":"https://api.github.com/repos/aspnet/KestrelHttpServer/issues/60","labels_url":"https://api.github.com/repos/aspnet/KestrelHttpServer/issues/60/labels{/name}","comments_url":"https://api.github.com/repos/aspnet/KestrelHttpServer/issues/60/comments","events_url":"https://api.github.com/repos/aspnet/KestrelHttpServer/issues/60/events","html_url":"https://github.com/aspnet/KestrelHttpServer/pull/60","id":56955711,"number":60,"title":"P/Invoke cleanup","user":{"login":"Tragetaschen","id":1947968,"avatar_url":"https://avatars.githubusercontent.com/u/1947968?v=3","gravatar_id":"","url":"https://api.github.com/users/Tragetaschen","html_url":"https://github.com/Tragetaschen","followers_url":"https://api.github.com/users/Tragetaschen/followers","following_url":"https://api.github.com/users/Tragetaschen/following{/other_user}","gists_url":"https://api.github.com/users/Tragetaschen/gists{/gist_id}","starred_url":"https://api.github.com/users/Tragetaschen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Tragetaschen/subscriptions","organizations_url":"https://api.github.com/users/Tragetaschen/orgs","repos_url":"https://api.github.com/users/Tragetaschen/repos","events_url":"https://api.github.com/users/Tragetaschen/events{/privacy}","received_events_url":"https://api.github.com/users/Tragetaschen/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/aspnet/KestrelHttpServer/labels/cla-not-required","name":"cla-not-required","color":"009800"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-02-08T15:44:06Z","updated_at":"2015-02-09T14:54:09Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/aspnet/KestrelHttpServer/pulls/60","html_url":"https://github.com/aspnet/KestrelHttpServer/pull/60","diff_url":"https://github.com/aspnet/KestrelHttpServer/pull/60.diff","patch_url":"https://github.com/aspnet/KestrelHttpServer/pull/60.patch"},"body":"This PR cleans up large portions of the P/Invoke handling of Kestrel to libuv. I know these are a lot of changes, but I have kept the single commits for easier following.\r\n\r\nThe highlights are:\r\n- Use `DllImport` and Mono's `DllMap` feature instead of manually loading and binding a platform-specific library\r\n- The various `SafeHandle`s now do all the required allocation work in their constructors\r\n- No more `unsafe`\r\n- Working shutdown\r\n\r\nI have tested on both Windows and Linux, but could not do so on a Mac simply because I don't have access to one. My test setup included a web application with an active SignalR connection. I was not able to reproduce any of the shutdown issues again (yet?)"},"comment":{"url":"https://api.github.com/repos/aspnet/KestrelHttpServer/issues/comments/73521107","html_url":"https://github.com/aspnet/KestrelHttpServer/pull/60#issuecomment-73521107","issue_url":"https://api.github.com/repos/aspnet/KestrelHttpServer/issues/60","id":73521107,"user":{"login":"Tragetaschen","id":1947968,"avatar_url":"https://avatars.githubusercontent.com/u/1947968?v=3","gravatar_id":"","url":"https://api.github.com/users/Tragetaschen","html_url":"https://github.com/Tragetaschen","followers_url":"https://api.github.com/users/Tragetaschen/followers","following_url":"https://api.github.com/users/Tragetaschen/following{/other_user}","gists_url":"https://api.github.com/users/Tragetaschen/gists{/gist_id}","starred_url":"https://api.github.com/users/Tragetaschen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Tragetaschen/subscriptions","organizations_url":"https://api.github.com/users/Tragetaschen/orgs","repos_url":"https://api.github.com/users/Tragetaschen/repos","events_url":"https://api.github.com/users/Tragetaschen/events{/privacy}","received_events_url":"https://api.github.com/users/Tragetaschen/received_events","type":"User","site_admin":false},"created_at":"2015-02-09T14:54:09Z","updated_at":"2015-02-09T14:54:09Z","body":"As a final step (well, let's see about that):\r\n\r\n- `UvHandles` are not `SafeHandle`s anymore\r\n\r\nSince they have to clean both loop resource as well as the unmanaged memory, the SafeHandle pattern does not really work: By the time the Finalizer runs, the loop might have been long brought down and posting to it won't work. The new base class implements a working UvHandle pattern and warns when a finalizer does the cleanup (I don't get the warning)."}}