Compare commits

...

2 Commits

Author SHA1 Message Date
Jarred Sumner
c0df1141cc fixup 2023-11-05 01:56:51 -07:00
Jarred Sumner
639cfe5b63 Fix libuv initialization code 2023-11-05 01:47:00 -07:00
3 changed files with 9 additions and 5 deletions

View File

@@ -1240,8 +1240,9 @@ pub const EventLoop = struct {
if (this.virtual_machine.event_loop_handle == null) {
// Ensure the uWS loop is created first on windows
if (comptime Environment.isWindows) {
this.uws_loop = bun.uws.Loop.get();
this.virtual_machine.event_loop_handle = bun.Async.Loop.get();
bun.windows.libuv.Loop.init();
this.uws_loop = bun.uws.Loop.init();
this.virtual_machine.event_loop_handle = this.uws_loop;
} else {
this.virtual_machine.event_loop_handle = bun.Async.Loop.get();
}

View File

@@ -526,10 +526,8 @@ pub const Loop = extern struct {
this.active_handles -= 1;
}
pub fn init() *Loop {
var this = get();
pub fn init() void {
uv_replace_allocator(
this,
@ptrCast(&bun.Mimalloc.mi_malloc),
@ptrCast(&bun.Mimalloc.mi_realloc),
@ptrCast(&bun.Mimalloc.mi_calloc),

View File

@@ -2424,6 +2424,11 @@ pub const UVLoop = extern struct {
us_wakeup_loop(this);
}
pub fn init() *UVLoop {
return uws_get_loop_with_native(bun.windows.libuv.Loop.get());
}
extern fn uws_get_loop_with_native(*anyopaque) *UVLoop;
pub const wake = wakeup;
pub fn tickWithTimeout(this: *UVLoop, _: i64) void {