Commit 329cd301 authored by Jason Madden's avatar Jason Madden

use custom struct for stat watcher.

parent 022a063d
......@@ -289,4 +289,11 @@ static void _gevent_generic_callback0(uv_handle_t* handle); // no extra args
static void _gevent_generic_callback1(uv_handle_t* handle, int arg); // one extra args. Everything will funnel through this
static void _gevent_poll_callback2(uv_handle_t* handle, int status, int events);
static void _gevent_fs_event_callback3(uv_handle_t* handle, const char* filename, int events, int status);
static void _gevent_fs_poll_callback3(uv_handle_t* handle, int status, const uv_stat_t* prev, const uv_stat_t* curr);
typedef struct _gevent_fs_poll_s {
uv_fs_poll_t handle;
uv_stat_t curr;
uv_stat_t prev;
} gevent_fs_poll_t;
static void _gevent_fs_poll_callback3(void* handle, int status, const uv_stat_t* prev, const uv_stat_t* curr);
......@@ -44,10 +44,35 @@ static void _gevent_fs_event_callback3(uv_handle_t* handle, const char* filename
{
_gevent_generic_callback1(handle, status < 0 ? status : events);
}
/*
typedef struct {
uv_fs_poll_t handle;
uv_stat_t curr;
uv_stat_t prev;
} gevent_fs_poll_t;
*/
static void _gevent_fs_poll_callback3(uv_handle_t* handle, int status, const uv_stat_t* prev, const uv_stat_t* curr)
typedef struct _gevent_fs_poll_s {
uv_fs_poll_t handle;
uv_stat_t curr;
uv_stat_t prev;
} gevent_fs_poll_t;
static void _gevent_fs_poll_callback3(void* handlep, int status, const uv_stat_t* prev, const uv_stat_t* curr)
{
// stat pointers are valid for this callback only.
// Will need a custom callback for this or somehow be able to pass
// copied data up.
// if given, copy them into our structure, where they can be reached
// from python, just like libev's watcher does, before calling
// the callback.
if(status < 0) {
return;
}
gevent_fs_poll_t* handle = (gevent_fs_poll_t*)handlep;
assert(status == 0);
handle->curr = *curr;
handle->prev = *prev;
_gevent_generic_callback1((uv_handle_t*)handle, 0);
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment