-
Notifications
You must be signed in to change notification settings - Fork 78
libuv based event loop / server #681
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
base: main
Are you sure you want to change the base?
Conversation
The debugger causes zmq errors somewhere
| debugger_config); | ||
| xeus::make_file_logger(xeus::xlogger::content, "xeus.log"))); | ||
| // xpyt::make_python_debugger, | ||
| // debugger_config); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is that a leftover or does the integration of libuv break the debugger?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
atm this is just the result of merging #620 with the most recent changes / to make it build again. So I assume the debugger stuff was not yet tried
JohanMabille
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to be able to switch between concurrency models (i.e. uvloop vs regular multithreaded server) or is uvloop supposed to become the only concurrency model of xeus-python? I will guess the second option (otherwise we would have to provide 4 kernels and it would becoming a mess) but better to ask.
| { | ||
| py::gil_scoped_acquire acquire; | ||
|
|
||
| // Create a uvloop and get pointer to the loop | ||
| py::module asyncio = py::module::import("asyncio"); | ||
| py::module uvloop = py::module::import("uvloop"); | ||
| py::object loop = uvloop.attr("new_event_loop")(); | ||
| asyncio.attr("set_event_loop")(loop); | ||
| py::object py_loop_ptr = uvloop.attr("loop").attr("libuv_get_loop_t_ptr")(loop); | ||
|
|
||
| void* raw_ptr = PyCapsule_GetPointer(py_loop_ptr.ptr(), nullptr); | ||
| if (!raw_ptr) | ||
| { | ||
| throw std::runtime_error("Failed to get uvloop pointer"); | ||
| } | ||
|
|
||
| uv_loop_ptr = static_cast<uv_loop_t*>(raw_ptr); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpicking: This could be moved in a dedicated function.
based on #620, but #620 was in a strange "broken" state:
xeus::make_xserver_uv_shell_mainbut inxeus-uvonlyxeus::make_xserver_uvexists.#include "xeus-zmq/xhook_base.hpp"is included, but this header is inxeus-uvnotxeus-zmq