コード例 #1
0
ファイル: handle.c プロジェクト: KennethWilke/luv
static int luv_has_ref(lua_State* L) {
  uv_handle_t* handle = luv_check_handle(L, 1);
  int ret = uv_has_ref(handle);
  if (ret < 0) return luv_error(L, ret);
  lua_pushboolean(L, ret);
  return 1;
}
コード例 #2
0
ファイル: handle.c プロジェクト: JoneXiong/pyuv
static PyObject *
Handle_ref_get(Handle *self, void *closure)
{
    UNUSED_ARG(closure);

    RAISE_IF_HANDLE_NOT_INITIALIZED(self, NULL);

    return PyBool_FromLong((long)uv_has_ref(self->uv_handle));
}
コード例 #3
0
ファイル: camluv_handle.c プロジェクト: forhappy/uv-ocaml
CAMLprim value
camluv_has_ref(value handle)
{
  CAMLparam1(handle);
  CAMLlocal1(has_ref);

  camluv_handle_t *camluv_handle = camluv_handle_struct_val(handle);
  if (camluv_handle_initialized(camluv_handle)) {
    // TODO: this handle is not initialized.
    has_ref = Val_int(0);
    CAMLreturn(has_ref);
  }
  if (uv_is_closing(camluv_handle->uv_handle)) {
    // TODO: this handle is closing.
    has_ref = Val_int(0);
    CAMLreturn(has_ref);
  }
  has_ref = Val_int(uv_has_ref(camluv_handle->uv_handle));

  CAMLreturn(has_ref);
}
コード例 #4
0
ファイル: loop.c プロジェクト: nubjs/libnub
void nub_loop_dispose(nub_loop_t* loop) {
  ASSERT(0 == uv_loop_alive(&loop->uvloop));
  ASSERT(1 == fuq_empty(&loop->blocking_queue_));
  ASSERT(0 == loop->ref_);
  ASSERT(NULL != loop->work_ping_);
  ASSERT(0 == uv_has_ref((uv_handle_t*) loop->work_ping_));
  ASSERT(1 == fuq_empty(&loop->thread_dispose_queue_));

  uv_close((uv_handle_t*) loop->work_ping_, nub__free_handle_cb);
  uv_close((uv_handle_t*) &loop->queue_processor_, NULL);
  ASSERT(0 == uv_is_active((uv_handle_t*) loop->work_ping_));

  fuq_dispose(&loop->thread_dispose_queue_);
  uv_mutex_destroy(&loop->thread_dispose_lock_);
  uv_sem_destroy(&loop->loop_lock_sem_);
  fuq_dispose(&loop->blocking_queue_);
  uv_mutex_destroy(&loop->queue_processor_lock_);
  fuq_dispose(&loop->work_queue_);
  uv_mutex_destroy(&loop->work_lock_);

  CHECK_EQ(0, uv_run(&loop->uvloop, UV_RUN_NOWAIT));
  CHECK_NE(UV_EBUSY, uv_loop_close(&loop->uvloop));
}
コード例 #5
0
ファイル: uvpp.hpp プロジェクト: pijyoi/libuv_wrapper
 bool has_ref() { return uv_has_ref(as_base_handle())!=0; }