Title: Move libuv calls to correct thread by srajko · Pull Request #1197 · nodegit/nodegit · GitHub
Open Graph Title: Move libuv calls to correct thread by srajko · Pull Request #1197 · nodegit/nodegit
X Title: Move libuv calls to correct thread by srajko · Pull Request #1197 · nodegit/nodegit
Description: This PR removes uv_async_init / uv_close calls that were being called each time we were making callbacks from async threadpool threads into the main thread (for example, for clone progress callbacks). The change was prompted by Axosoft/nsfw#12 - in our case, the uv_async_init calls were being called from threadpool threads and that violated libuv's thread safety requirements. The fix was to move the logic for these types of callbacks (I call them reverse callbacks in the code, since they are callbacks from the async threadpool code back into the main loop code) into our ThreadPool class, which now uses a single async handle and an internal queue to schedule these callbacks. While at it, I also removed our last use of sleep_for_ms and replaced it with a semaphore. We also had a return that would circumvent the uv_close - nodegit/generate/templates/partials/field_accessors.cc Line 142 in de3583b return; . With this change, that problem goes away. Finally, the batons we were using for these reverse callbacks were dynamically allocated and never deallocated. I took out the dynamic allocation to avoid this problem.
Open Graph Description: This PR removes uv_async_init / uv_close calls that were being called each time we were making callbacks from async threadpool threads into the main thread (for example, for clone progress callback...
X Description: This PR removes uv_async_init / uv_close calls that were being called each time we were making callbacks from async threadpool threads into the main thread (for example, for clone progress callback...
Opengraph URL: https://github.com/nodegit/nodegit/pull/1197
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:4c33e26d-7bdc-3b70-291b-d9fbacbf77d3 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | 86E0:153D66:CBEE4:113F8B:6A5B5468 |
| html-safe-nonce | f6017cd6e5292e189f50a249e2e73f76fd541f4c61f8830c8f9eeae14cb4e3c2 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4NkUwOjE1M0Q2NjpDQkVFNDoxMTNGOEI6NkE1QjU0NjgiLCJ2aXNpdG9yX2lkIjoiODcyMTQ3MDA5MzIzMzE4MTgwMCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | a0fbcf6103a9223e0fd09cc0612933825a4f3019339556e7f58a135bd9474ac1 |
| hovercard-subject-tag | pull_request:103417193 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/nodegit/nodegit/pull/1197/files |
| twitter:image | https://avatars.githubusercontent.com/u/291007?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/291007?s=400&v=4 |
| og:image:alt | This PR removes uv_async_init / uv_close calls that were being called each time we were making callbacks from async threadpool threads into the main thread (for example, for clone progress callback... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 5290d7e14309ad1e76106a9c4237bd1041517e83ea182c8ab756752cb0c6940b |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/nodegit/nodegit git https://github.com/nodegit/nodegit.git |
| octolytics-dimension-user_id | 657068 |
| octolytics-dimension-user_login | nodegit |
| octolytics-dimension-repository_id | 1383170 |
| octolytics-dimension-repository_nwo | nodegit/nodegit |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1383170 |
| octolytics-dimension-repository_network_root_nwo | nodegit/nodegit |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 9c975978430e9ad293956f2bbdaf153b1bd84a99 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width