Skip to content

Commit d094253

Browse files
committed
---
yaml --- r: 5660 b: refs/heads/master c: 53c9b9a h: refs/heads/master v: v3
1 parent 55142a9 commit d094253

File tree

2 files changed

+28
-18
lines changed

2 files changed

+28
-18
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 3ad4fa00ac0e3b78612eccce18fa6613f3125005
2+
refs/heads/master: 53c9b9a5dd7341dee2c600ae234ca741da8464de

trunk/src/rt/rust_uv.cpp

Lines changed: 27 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include "uv.h"
55

66
#include "rust_internal.h"
7+
#include "rust_scheduler.h"
78
#include "rust_upcall.h"
89

910
#ifdef __GNUC__
@@ -49,7 +50,7 @@ struct socket_data : public task_owned<socket_data> {
4950
struct req_connect : public uv_connect_t, public task_owned<req_connect> {};
5051
struct req_write : public uv_write_t, public task_owned<req_write> {};
5152

52-
extern "C" CDECL void aio_close_socket(rust_task *task, socket_data *);
53+
extern "C" CDECL void aio_close_socket(void *, socket_data *);
5354

5455
static uv_idle_s idle_handler;
5556

@@ -58,27 +59,31 @@ static void idle_callback(uv_idle_t* handle, int status) {
5859
task->yield();
5960
}
6061

61-
extern "C" CDECL void aio_init(rust_task *task) {
62+
extern "C" CDECL void aio_init(void *) {
63+
rust_task *task = rust_scheduler::get_task();
6264
LOG_UPCALL_ENTRY(task);
6365
iotask = task;
6466
uv_idle_init(uv_default_loop(), &idle_handler);
6567
uv_idle_start(&idle_handler, idle_callback);
6668
}
6769

68-
extern "C" CDECL void aio_run(rust_task *task) {
70+
extern "C" CDECL void aio_run(void *) {
71+
rust_task *task = rust_scheduler::get_task();
6972
LOG_UPCALL_ENTRY(task);
7073
idle_handler.data = task;
7174
uv_run(uv_default_loop());
7275
}
7376

7477
void nop_close(uv_handle_t* handle) {}
7578

76-
extern "C" CDECL void aio_stop(rust_task *task) {
79+
extern "C" CDECL void aio_stop(void *) {
80+
rust_task *task = rust_scheduler::get_task();
7781
LOG_UPCALL_ENTRY(task);
7882
uv_close((uv_handle_t*)&idle_handler, nop_close);
7983
}
8084

81-
static socket_data *make_socket(rust_task *task, rust_chan *chan) {
85+
static socket_data *make_socket(void *, rust_chan *chan) {
86+
rust_task *task = rust_scheduler::get_task();
8287
socket_data *data = new (task, "make_socket") socket_data;
8388
if (!data ||
8489
uv_tcp_init(uv_default_loop(), &data->socket)) {
@@ -155,8 +160,9 @@ static void new_connection(uv_stream_t *socket, int status) {
155160
server->chan->send(&client);
156161
}
157162

158-
extern "C" CDECL socket_data *aio_serve(rust_task *task, const char *ip,
159-
int port, chan_handle *_chan) {
163+
extern "C" CDECL socket_data *aio_serve(void *, const char *ip, int port,
164+
chan_handle *_chan) {
165+
rust_task *task = rust_scheduler::get_task();
160166
LOG_UPCALL_ENTRY(task);
161167
rust_chan *chan = task->get_chan_by_handle(_chan);
162168
if(!chan) return NULL;
@@ -201,13 +207,15 @@ static void free_socket(uv_handle_t *handle) {
201207
delete data;
202208
}
203209

204-
extern "C" CDECL void aio_close_socket(rust_task *task, socket_data *client) {
210+
extern "C" CDECL void aio_close_socket(void *, socket_data *client) {
211+
rust_task *task = rust_scheduler::get_task();
205212
LOG_UPCALL_ENTRY(task);
206213
uv_close((uv_handle_t*)&client->socket, free_socket);
207214
}
208215

209-
extern "C" CDECL void aio_close_server(rust_task *task, socket_data *server,
216+
extern "C" CDECL void aio_close_server(void *, socket_data *server,
210217
chan_handle *_chan) {
218+
rust_task *task = rust_scheduler::get_task();
211219
LOG_UPCALL_ENTRY(task);
212220
rust_chan *chan = task->get_chan_by_handle(_chan);
213221
if(!chan) return;
@@ -221,8 +229,8 @@ extern "C" CDECL void aio_close_server(rust_task *task, socket_data *server,
221229
chan->deref();
222230
}
223231

224-
extern "C" CDECL bool aio_is_null_client(rust_task *task,
225-
socket_data *server) {
232+
extern "C" CDECL bool aio_is_null_client(void *, socket_data *server) {
233+
rust_task *task = rust_scheduler::get_task();
226234
LOG_UPCALL_ENTRY(task);
227235
return server == NULL;
228236
}
@@ -234,8 +242,9 @@ static void connection_complete(uv_connect_t *req, int status) {
234242
free(req);
235243
}
236244

237-
extern "C" CDECL void aio_connect(rust_task *task, const char *host,
238-
int port, chan_handle *_chan) {
245+
extern "C" CDECL void aio_connect(void *, const char *host, int port,
246+
chan_handle *_chan) {
247+
rust_task *task = rust_scheduler::get_task();
239248
LOG_UPCALL_ENTRY(task);
240249
rust_chan *chan = task->get_chan_by_handle(_chan);
241250
uv_connect_t *req = NULL;
@@ -272,9 +281,9 @@ static void write_complete(uv_write_t *req, int status) {
272281
free(req);
273282
}
274283

275-
extern "C" CDECL void aio_writedata(rust_task *task, socket_data *data,
276-
char *buf, size_t size,
277-
chan_handle *_chan) {
284+
extern "C" CDECL void aio_writedata(void *, socket_data *data, char *buf,
285+
size_t size, chan_handle *_chan) {
286+
rust_task *task = rust_scheduler::get_task();
278287
LOG_UPCALL_ENTRY(task);
279288
rust_chan *chan = task->get_chan_by_handle(_chan);
280289
uv_write_t *req;
@@ -305,8 +314,9 @@ extern "C" CDECL void aio_writedata(rust_task *task, socket_data *data,
305314
task->fail();
306315
}
307316

308-
extern "C" CDECL void aio_read(rust_task *task, socket_data *data,
317+
extern "C" CDECL void aio_read(void *, socket_data *data,
309318
chan_handle *_chan) {
319+
rust_task *task = rust_scheduler::get_task();
310320
LOG_UPCALL_ENTRY(task);
311321
rust_chan *reader = task->get_chan_by_handle(_chan);
312322
if(!reader) return;

0 commit comments

Comments
 (0)