-
-
Notifications
You must be signed in to change notification settings - Fork 205
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
uv_loop_t escape hatch? #114
Comments
Can I ask what are the unwrapped functions?
Wouldn't it make much sense to add that escape hatch also to handles, requests and all the other classes that wrap a struct defined by libuv instead? |
I haven’t done a complete inventory, but the two in my code are debug functions that dump the active handles. I suggested uv_loop_t alone because that is the level at which I would expect to interact with a libuv-enabled library. Sharing handles and such seems more fraught with challenges. |
Don't worry, I didn't expect it. Just curious.
I think What about adding an
|
Not my library, so its up to you. If you’re asking how, in my opinion, this ought to look then I would strongly favour NOT using a conversion operator, and require the user who needs to do this exceptional thing to call a named member function. Preferably something that makes it crystal clear what is going on. Perhaps loop->get_internal_uv_type() or something. In general we don’t want these internal libuv data types to leak out, so when they are made available the code should be easy to spot and easy to search for. And I think the uv_loop_t is the safest one because the lifetime management issues are minimal — with connection handles and the like, they come and go more often so trying to share them with other code is much more likely to cause bugs around their lifetime. |
Yeah, I was asking for your opinion. What you said makes sense actually. I'm trying to find the best name, preferably a bit shorter then
Well, if you are going to work raw you must know exactly what you are doing after all. Otherwise you cannot avoid subtle bugs. A library can't help you in any case with this. |
Could an escape hatch be added to the Loop class that simply returns the internal uv_loop_t handle? I find myself having to add an accessor to get at it so that I can call any unwrapped functions (there are a couple still) or pass it to another libuv-based library.
The text was updated successfully, but these errors were encountered: