Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
zhaozg committed Nov 13, 2024
1 parent 9fe9251 commit 8478eef
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/test.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "luv.h"
#include "util.h"
#include "lhandle.h"
#include <lua.h>
#include <lualib.h>
Expand Down Expand Up @@ -89,13 +90,15 @@ static void walk_cb(uv_handle_t* handle, void* arg) {
// Skip foreign handles (shared event loop)
lua_rawgeti(L, LUA_REGISTRYINDEX, ctx->ht_ref);
lua_rawgetp(L, -1, data);
if (lua_isnil(L, -1)) {
printf("handle(%s:%p) can be process by Lua\n",
uv_handle_type_name(handle->type), handle);
} else {
printf("handle(%s:%p) can be process by C\n",
uv_handle_type_name(handle->type), handle);
}

#if LUV_UV_VERSION_GEQ(1, 19, 0)
printf("handle(%s:%p) can be process by %s\n",
uv_handle_type_name(handle->type), handle,
(lua_isnil(L, -1) ? "C" : "Lua" ));
#else
printf("handle(%d:%p) can be process by %s\n",
handle->type, handle (lua_isnil(L, -1) ? "C" : "Lua" ));
#endif
lua_pop(L, 2);
}

Expand Down

0 comments on commit 8478eef

Please sign in to comment.