Пример #1
0
/* initialize thread local key for the base kernel proc */
void
baseinit(hproc_t* p)
{
    if(uv_key_create(&prdakey))
        panic("TLS key create failed");
    uv_key_set(&prdakey, p);
}
Пример #2
0
static void
init(void) {
    logger_init(daemon_mode);

    setvbuf(stdout, NULL, _IONBF, 0);
    setvbuf(stderr, NULL, _IONBF, 0);

#ifndef _WIN32
    signal(SIGPIPE, SIG_IGN);
    signal(SIGCHLD, SIG_IGN);
    signal(SIGABRT, SIG_IGN);
#endif

    if (crypto_init(password)) {
        logger_log(LOG_ERR, "crypto init failed");
        exit(1);
    }

    resolver_prepare(nameserver_num);
    uv_key_create(&thread_resolver_key);

    if (idle_timeout == 0) {
        idle_timeout = 60;
    }
}
Пример #3
0
int wsn_thread_ctx_key_init()
{
  int err = uv_key_create(&tls_key_);
  if (err) {
    wsn_report_err(WSN_ERR_CREATE_TLS_KEY, "Failed to create TLS key, %s", uv_strerror(err));
    err = WSN_ERR_CREATE_TLS_KEY;
  }
  return err;
}
Пример #4
0
static void luv_work_init(lua_State* L) {
  luaL_newmetatable(L, "luv_work_ctx");
  lua_pushcfunction(L, luv_work_ctx_tostring);
  lua_setfield(L, -2, "__tostring");
  lua_pushcfunction(L, luv_work_ctx_gc);
  lua_setfield(L, -2, "__gc");
  lua_newtable(L);
  luaL_setfuncs(L, luv_work_ctx_methods, 0);
  lua_setfield(L, -2, "__index");
  lua_pop(L, 1);

  if (key_inited==0) {
    key_inited = 1;
    uv_key_create(&L_key);
  }
}
Пример #5
0
CAMLprim value
camluv_key_init(value unit)
{
  CAMLparam0();
  CAMLlocal1(key);

  int rc = -1;
  camluv_key_t *camluv_key = camluv_key_new();
  rc = uv_key_create(&(camluv_key->uv_key));
  if (rc != UV_OK) {
    // TODO: error handling.
  }
  camluv_key->initialized = 1;
  key = camluv_copy_key(camluv_key);

  CAMLreturn(key);
}
Пример #6
0
static mrb_value
mrb_uv_key_init(mrb_state *mrb, mrb_value self)
{
  uv_key_t *key;
  int err;

  mrb_iv_set(mrb, self, mrb_intern_lit(mrb, "values"), mrb_ary_new(mrb));

  key = (uv_key_t*)mrb_malloc(mrb, sizeof(uv_key_t));
  err = uv_key_create(key);
  if (err < 0) {
    mrb_free(mrb, key);
    mrb_uv_check_error(mrb, err);
  }
  DATA_PTR(self) = key;
  DATA_TYPE(self) = &mrb_uv_key_type;
  return self;
}
Пример #7
0
void initialize_http_request_cache()
{
    uv_key_create(&thread_cache_key);
}
Пример #8
0
void uvc_init(void){
	uv_key_create(&uvc_key);
}
Пример #9
0
void EventLoop::initKey() {
	uv_key_create(&tlsKey);
}