您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ uv_unref函数代码示例

51自学网 2021-06-03 09:28:29
  C++
这篇教程C++ uv_unref函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中uv_unref函数的典型用法代码示例。如果您正苦于以下问题:C++ uv_unref函数的具体用法?C++ uv_unref怎么用?C++ uv_unref使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了uv_unref函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: uv_unref

void V8SynchronizationContext::Unref(uv_edge_async_t* uv_edge_async){#if UV_VERSION_MAJOR==0 && UV_VERSION_MINOR<8    uv_unref(uv_default_loop());#else    uv_unref((uv_handle_t*)&uv_edge_async->uv_async);#endif  }
开发者ID:raduenuca,项目名称:edge,代码行数:8,


示例2: CefShutdown

void CefLoop::StopLoop(uv_handle_t* handle) {  CefShutdown();#if NODE_VERSION_AT_LEAST(0, 7, 9)  uv_unref((uv_handle_t *)&g_async);#else  uv_unref(uv_default_loop());#endif}
开发者ID:276361270,项目名称:appjs,代码行数:10,


示例3: uv_timer_stop

void CefLoop::Pause() {  if( !CefLoop::initialized_ || !CefLoop::running_ ) return;  uv_timer_stop(&timer);#if NODE_VERSION_AT_LEAST(0, 7, 9)  uv_unref((uv_handle_t *)&g_async);#else  uv_unref(uv_default_loop());#endif    CefLoop::running_ = false;}
开发者ID:276361270,项目名称:appjs,代码行数:14,


示例4: couv_unref

static int couv_unref(lua_State *L) {  uv_handle_t *handle;  handle = couvL_checkudataclass(L, 1, COUV_HANDLE_MTBL_NAME);  uv_unref(handle);  return 0;}
开发者ID:AsamQi,项目名称:couv,代码行数:7,


示例5: on_connection

/** * CB for new connection requests. */void on_connection(uv_stream_t *server, int status){  if (status < 0) {    fprintf(stderr, "New connection error: %s/n",             uv_strerror(uv_last_error(server->loop)));    return;  }    client_t *clnt = (client_t *)malloc(sizeof(client_t));  client_init(clnt);  uv_tcp_init(server->loop, &clnt->source);  if (uv_accept(server, (uv_stream_t *)&clnt->source) != 0) {    fprintf(stderr, "Accept failed: %s/n",             uv_strerror(uv_last_error(server->loop)));    uv_close((uv_handle_t *)&clnt->source, NULL);    free(clnt);    return;  }  // succesfull accept here  clnt->source.data = (void *)clnt;  uv_read_start((uv_stream_t *)&clnt->source, alloc_buffer, on_read);  // unref server to force program termination when client disconnects  uv_unref((uv_handle_t *)server);}
开发者ID:hrautila,项目名称:glme,代码行数:30,


示例6: FatalException

void ZipFile::Work_AfterReadFile(uv_work_t* req) {    HandleScope scope;    closure_t *closure = static_cast<closure_t *>(req->data);    TryCatch try_catch;    if (closure->error) {        Local<Value> argv[1] = { Exception::Error(String::New(closure->error_name.c_str())) };        closure->cb->Call(Context::GetCurrent()->Global(), 1, argv);    } else {        node::Buffer *retbuf = Buffer::New(reinterpret_cast<char *>(&closure->data[0]), closure->data.size());        Local<Value> argv[2] = { Local<Value>::New(Null()), Local<Value>::New(retbuf->handle_) };        closure->cb->Call(Context::GetCurrent()->Global(), 2, argv);    }    if (try_catch.HasCaught()) {        FatalException(try_catch);    }    closure->zf->Unref();    uv_unref(uv_default_loop());    closure->cb.Dispose();    delete closure;}
开发者ID:anoopsinha,项目名称:maui-epub,代码行数:25,


示例7: HTTPConnectionReadRequest

ssize_t HTTPConnectionReadRequest(HTTPConnectionRef const conn, HTTPMethod *const method, str_t *const out, size_t const max) {	if(!conn) return UV_EINVAL;	if(!max) return UV_EINVAL;	uv_buf_t buf[1];	int rc;	HTTPEvent type;	size_t len = 0;	for(;;) {		// Use unref because we shouldn't block the server		// on a request that may never arrive.		uv_unref((uv_handle_t *)conn->stream);		rc = HTTPConnectionPeek(conn, &type, buf);		uv_ref((uv_handle_t *)conn->stream);		if(rc < 0) return rc;		if(HTTPHeaderField == type || HTTPHeadersComplete == type) break;		HTTPConnectionPop(conn, buf->len);		if(HTTPMessageBegin == type) continue;		if(HTTPURL != type) {			assertf(0, "Unexpected HTTP event %d", type);			return UV_UNKNOWN;		}		if(len+buf->len+1 > max) return UV_EMSGSIZE;		memcpy(out+len, buf->base, buf->len);		len += buf->len;		out[len] = '/0';	}	*method = conn->parser->method;	return (ssize_t)len;}
开发者ID:rmoorman,项目名称:stronglink,代码行数:29,


示例8: assert

/* * Class:     com_oracle_libuv_handles_Handle * Method:    _unref * Signature: (J)V */JNIEXPORT void JNICALL Java_com_oracle_libuv_handles_Handle__1unref  (JNIEnv *env, jobject that, jlong ptr) {  assert(ptr);  uv_handle_t* handle = reinterpret_cast<uv_handle_t*>(ptr);  uv_unref(handle);}
开发者ID:dannyzhu,项目名称:jlibuv,代码行数:12,


示例9: uv_pipe_endgame

void uv_pipe_endgame(uv_pipe_t* handle) {  uv_err_t err;  int status;  if (handle->flags & UV_HANDLE_SHUTTING &&      !(handle->flags & UV_HANDLE_SHUT) &&      handle->write_reqs_pending == 0) {    close_pipe(handle, &status, &err);    if (handle->shutdown_req->cb) {      if (status == -1) {        LOOP->last_error = err;      }      handle->shutdown_req->cb(handle->shutdown_req, status);    }    handle->reqs_pending--;  }  if (handle->flags & UV_HANDLE_CLOSING &&      handle->reqs_pending == 0) {    assert(!(handle->flags & UV_HANDLE_CLOSED));    handle->flags |= UV_HANDLE_CLOSED;    if (handle->close_cb) {      handle->close_cb((uv_handle_t*)handle);    }    uv_unref();  }}
开发者ID:CrabDude,项目名称:node,代码行数:30,


示例10: tcp_recv

static void tcp_recv(uv_stream_t *handle, ssize_t nread, const uv_buf_t *buf){	uv_loop_t *loop = handle->loop;	struct worker_ctx *worker = loop->data;	/* Check for originator connection close. */	if (nread <= 0) {		if (handle->data) {			worker_exec(worker, (uv_handle_t *)handle, NULL, NULL);		}		if (!uv_is_closing((uv_handle_t *)handle)) {			uv_close((uv_handle_t *)handle, handle_free);		}		return;	}		int ret = worker_process_tcp(worker, (uv_handle_t *)handle, (const uint8_t *)buf->base, nread);	if (ret == 0) {		/* Push - pull, stop reading from this handle until		 * the task is finished. Since the handle has no track of the		 * pending tasks, it might be freed before the task finishes		 * leading various errors. */		uv_unref((uv_handle_t *)handle);		io_stop_read((uv_handle_t *)handle);	}	mp_flush(worker->pkt_pool.ctx);}
开发者ID:PaulosV,项目名称:knot-resolver,代码行数:27,


示例11: releaseHandle

 ALWAYS_INLINE void releaseHandle(uv_idle_ext_t *handle) {     if(handle->start){         uv_idle_stop((uv_idle_t *) handle);     }     uv_unref((uv_handle_t *) handle);     delete handle; }
开发者ID:RickySu,项目名称:hhvm-ext-uv,代码行数:7,


示例12: uv_getaddrinfo_done

static int uv_getaddrinfo_done(eio_req* req) {  uv_getaddrinfo_t* handle = req->data;  struct addrinfo *res = handle->res;  handle->res = NULL;  uv_unref(handle->loop);  free(handle->hints);  free(handle->service);  free(handle->hostname);  if (handle->retcode == 0) {    /* OK */#if EAI_NODATA /* FreeBSD deprecated EAI_NODATA */  } else if (handle->retcode == EAI_NONAME || handle->retcode == EAI_NODATA) {#else  } else if (handle->retcode == EAI_NONAME) {#endif    uv__set_sys_error(handle->loop, ENOENT); /* FIXME compatibility hack */  } else {    handle->loop->last_err.code = UV_EADDRINFO;    handle->loop->last_err.sys_errno_ = handle->retcode;  }  handle->cb(handle, handle->retcode, res);  return 0;}
开发者ID:Mandar-Shinde,项目名称:node,代码行数:28,


示例13: deletingObjects

EventLoop::EventLoop() : deletingObjects(false) {	uv_loop_init(&loop);	deleteObjectsHandle.data = this;	uv_prepare_init(&loop, &deleteObjectsHandle);	uv_prepare_start(&deleteObjectsHandle, &staticDeleteObjects);	uv_unref((uv_handle_t*) &deleteObjectsHandle);}
开发者ID:glandu2,项目名称:librzu,代码行数:7,


示例14: uv_fs_req_cleanup

void uv_fs_req_cleanup(uv_fs_t* req) {  uv_loop_t* loop = req->loop;  if (req->flags & UV_FS_CLEANEDUP) {    return;  }  if (req->flags & UV_FS_FREE_ARG0 && req->arg0) {    free(req->arg0);    req->arg0 = NULL;  }  if (req->flags & UV_FS_FREE_ARG1 && req->arg1) {    free(req->arg1);    req->arg1 = NULL;  }  if (req->flags & UV_FS_FREE_PTR && req->ptr) {    free(req->ptr);  }  req->ptr = NULL;  if (req->path) {    free(req->path);    req->path = NULL;  }  if (req->flags & UV_FS_ASYNC_QUEUED) {    uv_unref(loop);  }  req->flags |= UV_FS_CLEANEDUP;}
开发者ID:Cahya,项目名称:node,代码行数:34,


示例15: uv_unref

void NodeMap::renderFinished() {    Nan::HandleScope scope;    // We're done with this render call, so we're unrefing so that the loop could close.    uv_unref(reinterpret_cast<uv_handle_t *>(async));    // There is no render pending anymore, we the GC could now delete this object if it went out    // of scope.    Unref();    // Move the callback and image out of the way so that the callback can start a new render call.    auto cb = std::move(callback);    auto img = std::move(image);    assert(cb);    // These have to be empty to be prepared for the next render call.    assert(!callback);    assert(!image.data);    if (error) {        std::string errorMessage;        try {            std::rethrow_exception(error);        } catch (const std::exception& ex) {            errorMessage = ex.what();        }        v8::Local<v8::Value> argv[] = {            Nan::Error(errorMessage.c_str())        };        // This must be empty to be prepared for the next render call.        error = nullptr;        assert(!error);        cb->Call(1, argv);    } else if (img.data) {        v8::Local<v8::Object> pixels = Nan::NewBuffer(            reinterpret_cast<char *>(img.data.get()), img.size(),            // Retain the data until the buffer is deleted.            [](char *, void * hint) {                delete [] reinterpret_cast<uint8_t*>(hint);            },            img.data.get()        ).ToLocalChecked();        img.data.release();        v8::Local<v8::Value> argv[] = {            Nan::Null(),            pixels        };        cb->Call(2, argv);    } else {        v8::Local<v8::Value> argv[] = {            Nan::Error("Didn't get an image")        };        cb->Call(1, argv);    }}
开发者ID:AJcravea,项目名称:mapbox-gl-native,代码行数:60,


示例16: gpr_log

grpc_endpoint *grpc_tcp_create(uv_tcp_t *handle,                               grpc_resource_quota *resource_quota,                               char *peer_string) {  grpc_tcp *tcp = (grpc_tcp *)gpr_malloc(sizeof(grpc_tcp));  if (grpc_tcp_trace) {    gpr_log(GPR_DEBUG, "Creating TCP endpoint %p", tcp);  }  /* Disable Nagle's Algorithm */  uv_tcp_nodelay(handle, 1);  memset(tcp, 0, sizeof(grpc_tcp));  tcp->base.vtable = &vtable;  tcp->handle = handle;  handle->data = tcp;  gpr_ref_init(&tcp->refcount, 1);  tcp->peer_string = gpr_strdup(peer_string);  tcp->shutting_down = false;  tcp->resource_user = grpc_resource_user_create(resource_quota, peer_string);  /* Tell network status tracking code about the new endpoint */  grpc_network_status_register_endpoint(&tcp->base);#ifndef GRPC_UV_TCP_HOLD_LOOP  uv_unref((uv_handle_t *)handle);#endif  return &tcp->base;}
开发者ID:yugui,项目名称:grpc,代码行数:29,


示例17: http_request_cache_configure_listener

void http_request_cache_configure_listener(uv_loop_t* loop, uv_async_t* handle){    uv_timer_t* cache_invalidation_timer = malloc(sizeof(uv_timer_t));    uv_timer_init(loop, cache_invalidation_timer);    uv_timer_start(cache_invalidation_timer, http_request_cache_timer, 500, 500);    uv_unref((uv_handle_t*) cache_invalidation_timer);}
开发者ID:JackDanger,项目名称:Haywire,代码行数:7,


示例18: connection_consumer_start

void connection_consumer_start(void *arg){    int rc;    struct server_ctx *ctx;    uv_loop_t* loop;        ctx = arg;    loop = uv_loop_new();    listener_event_loops[ctx->index] = *loop;        http_request_cache_configure_listener(loop, &listener_async_handles[ctx->index]);    uv_barrier_wait(listeners_created_barrier);        rc = uv_async_init(loop, &ctx->async_handle, connection_consumer_close);    uv_unref((uv_handle_t*) &ctx->async_handle);        /* Wait until the main thread is ready. */    uv_sem_wait(&ctx->semaphore);    get_listen_handle(loop, (uv_stream_t*) &ctx->server_handle);    uv_sem_post(&ctx->semaphore);        rc = uv_listen((uv_stream_t*)&ctx->server_handle, 128, connection_consumer_new_connection);    rc = uv_run(loop, UV_RUN_DEFAULT);        uv_loop_delete(loop);}
开发者ID:anurse,项目名称:Haywire,代码行数:26,


示例19: uv_process_tcp_connect_req

void uv_process_tcp_connect_req(uv_loop_t* loop, uv_tcp_t* handle,    uv_connect_t* req) {  assert(handle->type == UV_TCP);  if (req->cb) {    if (REQ_SUCCESS(req)) {      if (setsockopt(handle->socket,                      SOL_SOCKET,                      SO_UPDATE_CONNECT_CONTEXT,                      NULL,                      0) == 0) {        uv_connection_init((uv_stream_t*)handle);        loop->active_tcp_streams++;        ((uv_connect_cb)req->cb)(req, 0);      } else {        uv__set_sys_error(loop, WSAGetLastError());        ((uv_connect_cb)req->cb)(req, -1);      }    } else {      uv__set_sys_error(loop, GET_REQ_SOCK_ERROR(req));      ((uv_connect_cb)req->cb)(req, -1);    }  }  DECREASE_PENDING_REQ_COUNT(handle);  uv_unref(loop);}
开发者ID:InfamousNugz,项目名称:dnscrypt-proxy,代码行数:27,


示例20: uv_fs_event_endgame

void uv_fs_event_endgame(uv_loop_t* loop, uv_fs_event_t* handle) {  if (handle->flags & UV_HANDLE_CLOSING &&      !handle->req_pending) {    assert(!(handle->flags & UV_HANDLE_CLOSED));    handle->flags |= UV_HANDLE_CLOSED;    if (handle->buffer) {      _aligned_free(handle->buffer);      handle->buffer = NULL;    }    if (handle->filew) {      free(handle->filew);      handle->filew = NULL;    }    if (handle->short_filew) {      free(handle->short_filew);      handle->short_filew = NULL;    }    if (handle->filename) {      free(handle->filename);      handle->filename = NULL;    }    if (handle->close_cb) {      handle->close_cb((uv_handle_t*)handle);    }    uv_unref(loop);  }}
开发者ID:Laner,项目名称:gitbin,代码行数:33,


示例21: uv_process_tcp_write_req

void uv_process_tcp_write_req(uv_loop_t* loop, uv_tcp_t* handle,    uv_write_t* req) {  assert(handle->type == UV_TCP);  assert(handle->write_queue_size >= req->queued_bytes);  handle->write_queue_size -= req->queued_bytes;  if (handle->flags & UV_HANDLE_EMULATE_IOCP) {    if (req->wait_handle != INVALID_HANDLE_VALUE) {      UnregisterWait(req->wait_handle);    }    if (req->event_handle) {      CloseHandle(req->event_handle);    }  }  if (req->cb) {    uv__set_sys_error(loop, GET_REQ_SOCK_ERROR(req));    ((uv_write_cb)req->cb)(req, loop->last_err.code == UV_OK ? 0 : -1);  }  handle->write_reqs_pending--;  if (handle->flags & UV_HANDLE_SHUTTING &&      handle->write_reqs_pending == 0) {    uv_want_endgame(loop, (uv_handle_t*)handle);  }  DECREASE_PENDING_REQ_COUNT(handle);  uv_unref(loop);}
开发者ID:InfamousNugz,项目名称:dnscrypt-proxy,代码行数:30,


示例22: MVM_io_syncstream_write_str

MVMint64 MVM_io_syncstream_write_str(MVMThreadContext *tc, MVMOSHandle *h, MVMString *str, MVMint64 newline) {    MVMIOSyncStreamData *data = (MVMIOSyncStreamData *)h->body.data;    MVMuint8 *output;    MVMint64 output_size;    uv_write_t *req;    uv_buf_t write_buf;    int r;    output = MVM_string_encode(tc, str, 0, -1, &output_size, data->encoding);    if (newline) {        output = (MVMuint8 *)realloc(output, ++output_size);        output[output_size - 1] = '/n';    }    req = malloc(sizeof(uv_write_t));    write_buf = uv_buf_init(output, output_size);    uv_ref((uv_handle_t *)data->handle);    if ((r = uv_write(req, data->handle, &write_buf, 1, write_cb)) < 0) {        uv_unref((uv_handle_t *)data->handle);        free(req);        free(output);        MVM_exception_throw_adhoc(tc, "Failed to write string to stream: %s", uv_strerror(r));    }    else {        uv_run(tc->loop, UV_RUN_DEFAULT);        free(output);    }    data->total_bytes_written += output_size;    return output_size;}
开发者ID:BlastarIndia,项目名称:MoarVM,代码行数:30,


示例23: uv_ares_init_options

/* TODO: share this with windows? */int uv_ares_init_options(uv_loop_t* loop, ares_channel *channelptr,    struct ares_options *options, int optmask) {  int rc;  /* only allow single init at a time */  if (loop->channel != NULL) {    uv__set_artificial_error(loop, UV_EALREADY);    return -1;  }  /* set our callback as an option */  options->sock_state_cb = uv__ares_sockstate_cb;  options->sock_state_cb_data = loop;  optmask |= ARES_OPT_SOCK_STATE_CB;  /* We do the call to ares_init_option for caller. */  rc = ares_init_options(channelptr, options, optmask);  /* if success, save channel */  if (rc == ARES_SUCCESS) {    loop->channel = *channelptr;  }   /*   * Initialize the timeout timer. The timer won't be started until the   * first socket is opened.   */  uv_timer_init(loop, &loop->timer);  uv_unref(loop);  loop->timer.data = loop;  return rc;}
开发者ID:Credochen,项目名称:node,代码行数:34,


示例24: socket_bind

static void socket_bind(MVMThreadContext *tc, MVMOSHandle *h, MVMString *host, MVMint64 port, MVMint32 backlog) {    MVMIOSyncSocketData *data = (MVMIOSyncSocketData *)h->body.data;    if (!data->ss.handle) {        struct sockaddr *dest    = MVM_io_resolve_host_name(tc, host, port);        uv_tcp_t        *socket  = MVM_malloc(sizeof(uv_tcp_t));        int r;        if ((r = uv_tcp_init(tc->loop, socket)) != 0 ||                (r = uv_tcp_bind(socket, dest, 0)) != 0) {            MVM_free(socket);            MVM_free(dest);            MVM_exception_throw_adhoc(tc, "Failed to bind: %s", uv_strerror(r));        }        MVM_free(dest);        /* Start listening, but unref the socket so it won't get in the way of         * other things we want to do on this event loop. */        socket->data = data;        if ((r = uv_listen((uv_stream_t *)socket, backlog, on_connection)) != 0) {            MVM_free(socket);            MVM_exception_throw_adhoc(tc, "Failed to listen: %s", uv_strerror(r));        }        uv_unref((uv_handle_t *)socket);        data->ss.handle = (uv_stream_t *)socket;    }    else {        MVM_exception_throw_adhoc(tc, "Socket is already bound or connected");    }}
开发者ID:stmuk,项目名称:MoarVM,代码行数:30,


示例25: on_connection

static void on_connection(uv_stream_t *server, int status) {    /* Stash data for a later accept call (safe as we specify a queue of just     * one connection). Decrement reference count also. */    MVMIOSyncSocketData *data = (MVMIOSyncSocketData *)server->data;    data->accept_server = server;    data->accept_status = status;    uv_unref((uv_handle_t *)server);}
开发者ID:stmuk,项目名称:MoarVM,代码行数:8,


示例26: uv__after_work

static int uv__after_work(eio_req *eio) {  uv_work_t* req = eio->data;  uv_unref(req->loop);  if (req->after_work_cb) {    req->after_work_cb(req);  }  return 0;}
开发者ID:adrienschuler,项目名称:node,代码行数:8,


示例27: Handle_func_unref

static PyObject *Handle_func_unref(Handle *self){    RAISE_IF_HANDLE_NOT_INITIALIZED(self, NULL);    RAISE_IF_HANDLE_CLOSED(self, PyExc_HandleClosedError, NULL);    uv_unref(self->uv_handle);    Py_RETURN_NONE;}
开发者ID:ayanamist,项目名称:pyuv,代码行数:8,


示例28: IAssert

void TSockSys::UnrefLoop() { 	IAssert(LoopRef != NULL);	// unrefernce the timer	uv_unref((uv_handle_t*)LoopRef); 	// kill the timer	uv_close((uv_handle_t*)LoopRef, NULL);	LoopRef = NULL;}
开发者ID:davidd2k,项目名称:qminer,代码行数:8,


示例29: on_connect

static void on_connect(uv_connect_t* req, int status) {    uv_unref((uv_handle_t *)req->handle);    if (status < 0) {        MVMThreadContext *tc = ((MVMIOSyncSocketData *)req->data)->ss.cur_tc;        MVM_free(req);        MVM_exception_throw_adhoc(tc, "Failed to connect: %s", uv_strerror(status));    }}
开发者ID:stmuk,项目名称:MoarVM,代码行数:8,



注:本文中的uv_unref函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ uv_want_endgame函数代码示例
C++ uv_translate_sys_error函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。