{"action":"created","issue":{"url":"https://api.github.com/repos/libuv/libuv/issues/267","repository_url":"https://api.github.com/repos/libuv/libuv","labels_url":"https://api.github.com/repos/libuv/libuv/issues/267/labels{/name}","comments_url":"https://api.github.com/repos/libuv/libuv/issues/267/comments","events_url":"https://api.github.com/repos/libuv/libuv/issues/267/events","html_url":"https://github.com/libuv/libuv/issues/267","id":61048337,"node_id":"MDU6SXNzdWU2MTA0ODMzNw==","number":267,"title":"Pluggable thread pool","user":{"login":"bnoordhuis","id":275871,"node_id":"MDQ6VXNlcjI3NTg3MQ==","avatar_url":"https://avatars0.githubusercontent.com/u/275871?v=4","gravatar_id":"","url":"https://api.github.com/users/bnoordhuis","html_url":"https://github.com/bnoordhuis","followers_url":"https://api.github.com/users/bnoordhuis/followers","following_url":"https://api.github.com/users/bnoordhuis/following{/other_user}","gists_url":"https://api.github.com/users/bnoordhuis/gists{/gist_id}","starred_url":"https://api.github.com/users/bnoordhuis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bnoordhuis/subscriptions","organizations_url":"https://api.github.com/users/bnoordhuis/orgs","repos_url":"https://api.github.com/users/bnoordhuis/repos","events_url":"https://api.github.com/users/bnoordhuis/events{/privacy}","received_events_url":"https://api.github.com/users/bnoordhuis/received_events","type":"User","site_admin":false},"labels":[{"id":163844368,"node_id":"MDU6TGFiZWwxNjM4NDQzNjg=","url":"https://api.github.com/repos/libuv/libuv/labels/feature-request","name":"feature-request","color":"fad8c7","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":20,"created_at":"2015-03-13T11:56:59Z","updated_at":"2018-08-29T12:58:34Z","closed_at":null,"author_association":"MEMBER","body":"This is a feature that io.js will need in the near future.  I'm going to self-assign but if someone else wants to work on it, please comment.\n\nGoal: add a hook that lets the libuv user override the built-in thread pool.  I think it'll look something like this:\n\n``` c\nstruct uv_threadpool_work;  /* Opaque structure. */\ntypedef int (*uv_threadpool_add_cb)(struct uv_threadpool_work* work);\ntypedef int (*uv_threadpool_cancel_cb)(struct uv_threadpool_work* work);\n/* cancel_cb == NULL means calls to uv_cancel() always fail with UV_EBUSY. */\nvoid uv_threadpool_set_callbacks(uv_threadpool_add_cb add_cb,\n                                 uv_threadpool_cancel_cb cancel_cb);\n/* User calls this when work is complete. Should probably be safe to call from any thread. */\nvoid uv_threadpool_complete(struct uv_threadpool_work* work);\n```\n\nMaybe we want to extend the callbacks with a second argument for passing options, either as flags or, if we want to be extensible, a struct:\n\n``` c\nenum uv_threadpool_options_version {\n  UV_THREADPOOL_OPTIONS_V1\n/* Enum for symbolic debugging, #define for feature detection. */\n#define UV_THREADPOOL_OPTIONS_V1 UV_THREADPOOL_OPTIONS_V1\n};\n\nstruct uv_threadpool_options_v1 {\n  int priority;  /* Just an example. */\n};\n\nstruct uv_threadpool_options {\n  enum uv_threadpool_options_version version;\n  union {\n    struct uv_threadpool_options_v1 v1;\n    /* Extend with v2, v3, etc. when the need arises. */\n  } u;\n};\n```\n"},"comment":{"url":"https://api.github.com/repos/libuv/libuv/issues/comments/416943130","html_url":"https://github.com/libuv/libuv/issues/267#issuecomment-416943130","issue_url":"https://api.github.com/repos/libuv/libuv/issues/267","id":416943130,"node_id":"MDEyOklzc3VlQ29tbWVudDQxNjk0MzEzMA==","user":{"login":"cjihrig","id":2512748,"node_id":"MDQ6VXNlcjI1MTI3NDg=","avatar_url":"https://avatars1.githubusercontent.com/u/2512748?v=4","gravatar_id":"","url":"https://api.github.com/users/cjihrig","html_url":"https://github.com/cjihrig","followers_url":"https://api.github.com/users/cjihrig/followers","following_url":"https://api.github.com/users/cjihrig/following{/other_user}","gists_url":"https://api.github.com/users/cjihrig/gists{/gist_id}","starred_url":"https://api.github.com/users/cjihrig/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cjihrig/subscriptions","organizations_url":"https://api.github.com/users/cjihrig/orgs","repos_url":"https://api.github.com/users/cjihrig/repos","events_url":"https://api.github.com/users/cjihrig/events{/privacy}","received_events_url":"https://api.github.com/users/cjihrig/received_events","type":"User","site_admin":false},"created_at":"2018-08-29T12:58:34Z","updated_at":"2018-08-29T12:58:34Z","author_association":"CONTRIBUTOR","body":"Your call. We are going to want to get v2 out the door in the coming months so that we don't end up on the hook supporting v1 until Node 12 goes EOL. That said, I wouldn't go too wild if it's going to make upgrading to v2 a huge pain for users."}}
{"actor":{"display_login":"cjihrig"}}