Exemple #1
0
LLUV_INTERNAL lluv_req_t* lluv_req_new(lua_State *L, uv_req_type type, lluv_handle_t *h){
  size_t extra_size = uv_req_size(type) - sizeof(uv_req_t);
  lluv_req_t *req = (lluv_req_t*)lluv_alloc(L, sizeof(lluv_req_t) + extra_size);

  req->req.data = req;
  req->handle   = h;
  req->cb       = luaL_ref(L, LLUV_LUA_REGISTRY);
  req->arg      = LUA_NOREF;
  req->ctx      = LUA_NOREF;

  if(h) lluv_handle_lock(L, h, LLUV_LOCK_REQ);

  return req;
}
Exemple #2
0
extern "C" size_t
rust_uv_req_size(uintptr_t type) {
  return uv_req_size((uv_req_type)type);
}