static int luv_new_fs_poll(lua_State* L) { uv_fs_poll_t* handle = lua_newuserdata(L, sizeof(*handle)); int ret = uv_fs_poll_init(luv_loop(L), handle); if (ret < 0) { lua_pop(L, 1); return luv_error(L, ret); } handle->data = luv_setup_handle(L); return 1; }
/* * Class: com_oracle_libuv_handles_FilePollHandle * Method: _new * Signature: (J)J */ JNIEXPORT jlong JNICALL Java_com_oracle_libuv_handles_FilePollHandle__1new (JNIEnv *env, jclass cls, jlong loop) { assert(loop); uv_loop_t* lp = reinterpret_cast<uv_loop_t*>(loop); uv_fs_poll_t* fs_poll = new uv_fs_poll_t(); int r = uv_fs_poll_init(lp, fs_poll); if (r) { ThrowException(env, fs_poll->loop, "uv_fs_poll_init"); } else { fs_poll->data = new FilePollCallbacks(); } return reinterpret_cast<jlong>(fs_poll); }