Skip to content

Commit 9a5d197

Browse files
olsonjefferybrson
authored andcommitted
don't use ::malloc for initializing the global_async_handle in rust_kernel
1 parent f21d25b commit 9a5d197

File tree

4 files changed

+4
-7
lines changed

4 files changed

+4
-7
lines changed

src/libstd/uv_hl.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ native mod rustrt {
1717
fn rust_uv_get_kernel_global_chan_ptr() -> *libc::uintptr_t;
1818
fn rust_uv_get_kernel_global_async_handle() -> **libc::c_void;
1919
fn rust_uv_set_kernel_global_async_handle(handle: *ll::uv_async_t);
20-
fn rust_uv_free_kernel_global_async_handle();
2120
}
2221

2322
#[doc = "

src/rt/rust_kernel.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,9 @@ rust_kernel::rust_kernel(rust_env *env) :
2727
// set up storage of pointers needed to
2828
// access the global loop.
2929
global_loop_chan = 0;
30-
global_async_handle = (void**)::malloc( // FIXME--can't use this->malloc()
31-
sizeof(void*)); // .. what do?
30+
int foo = 0;
31+
async_handle_stub = (void*)&foo;
32+
global_async_handle = &async_handle_stub;
3233
*global_async_handle = (void*)0;
3334

3435
// Create the single threaded scheduler that will run on the platform's

src/rt/rust_kernel.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ class rust_kernel {
7575

7676
// Used to communicate with the process-side, global libuv loop
7777
uintptr_t global_loop_chan;
78+
void* async_handle_stub;
7879
void** global_async_handle;
7980

8081
public:

src/rt/rust_uv.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,3 @@ extern "C" void
454454
rust_uv_set_kernel_global_async_handle(uv_async_t* handle) {
455455
rust_get_current_task()->kernel->set_global_async_handle((void*)handle);
456456
}
457-
extern "C" void
458-
rust_uv_free_kernel_global_async_handle() {
459-
free((void*)rust_get_current_task()->kernel->get_global_async_handle());
460-
}

0 commit comments

Comments
 (0)