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

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

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

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

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

示例1: mn_loadfile

/* * Synchronous readfile using libuv APIs. * TODO: Use for module loading. */duk_ret_tmn_loadfile(duk_context *ctx) {	const char *path = duk_require_string(ctx, 0);	uv_fs_t req;	int fd = 0;	size_t size;	char *chunk;	uv_buf_t buf;	if (uv_fs_open(mn_loop, &req, path, O_RDONLY, 0644, NULL) < 0) {		goto sadplace;	}	uv_fs_req_cleanup(&req);	fd = req.result;	if (uv_fs_fstat(mn_loop, &req, fd, NULL) < 0) {		goto sadplace;	}	uv_fs_req_cleanup(&req);	size = req.statbuf.st_size;	chunk = duk_alloc(ctx, size);	buf = uv_buf_init(chunk, size);	if (uv_fs_read(mn_loop, &req, fd, &buf, 1, 0, NULL) < 0) {		duk_free(ctx, chunk);		goto sadplace;	}	uv_fs_req_cleanup(&req);	duk_push_lstring(ctx, chunk, size);	duk_free(ctx, chunk);	uv_fs_close(mn_loop, &req, fd, NULL);	uv_fs_req_cleanup(&req);	return 1;	sadplace:		uv_fs_req_cleanup(&req);		if (fd) {			uv_fs_close(mn_loop, &req, fd, NULL);		}		uv_fs_req_cleanup(&req);		duk_error(			ctx,			DUK_ERR_ERROR,			"%s: %s: %s",			uv_err_name(req.result),			uv_strerror(req.result),			path		);}
开发者ID:hypoalex,项目名称:mininode,代码行数:58,


示例2: open_cb

static void open_cb(uv_fs_t* req) {  int r;  ASSERT(req == &open_req1);  ASSERT(req->fs_type == UV_FS_OPEN);  if (req->result < 0) {    /* TODO get error with uv_last_error() */    fprintf(stderr, "async open error: %d/n", req->errorno);    ASSERT(0);  }  open_cb_count++;  ASSERT(req->path);  ASSERT(memcmp(req->path, "test_file2/0", 11) == 0);  uv_fs_req_cleanup(req);  memset(buf, 0, sizeof(buf));  r = uv_fs_read(loop, &read_req, open_req1.result, buf, sizeof(buf), -1,      read_cb);}
开发者ID:amuxtux,项目名称:libuv,代码行数:17,


示例3: read_cb

static void read_cb(uv_fs_t* req) {  int r;  ASSERT(req == &read_req);  ASSERT(req->fs_type == UV_FS_READ);  ASSERT(req->result >= 0);  /* FIXME(bnoordhuis) Check if requested size? */  read_cb_count++;  uv_fs_req_cleanup(req);  if (read_cb_count == 1) {    ASSERT(strcmp(buf, test_buf) == 0);    r = uv_fs_ftruncate(loop, &ftruncate_req, open_req1.result, 7,        ftruncate_cb);  } else {    ASSERT(strcmp(buf, "test-bu") == 0);    r = uv_fs_close(loop, &close_req, open_req1.result, close_cb);  }  ASSERT(r == 0);}
开发者ID:slshaw115,项目名称:node,代码行数:17,


示例4: on_fs_callback

static void on_fs_callback(uv_fs_t *req) {  UNWRAP(req);  int ret_n;  if (LUA_NOREF == holder->threadref || holder->use_lcb) {    push_callback_no_obj(L, holder, FSR__CBNAME);    ret_n = push_results(L, req);    lua_call(L, ret_n, 0);  } else { /* coroutines */    ret_n = push_results(L, req);    /*luv_lua_debug_stackdump(L, "RESUME");*/    lua_resume(L, ret_n);  }  uv_fs_req_cleanup(req);  lev_handle_unref(L, (LevRefStruct_t *)holder);}
开发者ID:connectFree,项目名称:lev,代码行数:17,


示例5: check_mkdtemp_result

static void check_mkdtemp_result(uv_fs_t* req) {  int r;  TUV_ASSERT(req->fs_type == UV_FS_MKDTEMP);  TUV_ASSERT(req->result == 0);  TUV_ASSERT(req->path);  TUV_ASSERT(strlen(req->path) == 15);  TUV_ASSERT(memcmp(req->path, "test_dir_", 9) == 0);  TUV_ASSERT(memcmp(req->path + 9, "XXXXXX", 6) != 0);  check_permission(req->path, 0700);  /* Check if req->path is actually a directory */  r = uv_fs_stat(uv_default_loop(), &stat_req, req->path, NULL);  TUV_ASSERT(r == 0);  TUV_ASSERT(((uv_stat_t*)stat_req.ptr)->st_mode & S_IFDIR);  uv_fs_req_cleanup(&stat_req);}
开发者ID:esevan,项目名称:libtuv,代码行数:17,


示例6: is_executable

/* * Return TRUE if "name" is an executable file, FALSE if not or it doesn't * exist. */static int is_executable(const char_u *name){  uv_fs_t request;  int result = uv_fs_stat(uv_default_loop(), &request, (const char*) name, NULL);  uint64_t mode = request.statbuf.st_mode;  uv_fs_req_cleanup(&request);  if (result != 0) {    return FALSE;  }  if (S_ISREG(mode) && (S_IEXEC & mode)) {    return TRUE;  }  return FALSE;}
开发者ID:EchoLiao,项目名称:neovim,代码行数:21,


示例7: chown_root_cb

static void chown_root_cb(uv_fs_t* req) {  TUV_ASSERT(req->fs_type == UV_FS_CHOWN);#if defined(_WIN32) || defined(__NUTTX__)  /* On windows, chown is a no-op and always succeeds. */  TUV_ASSERT(req->result == 0);#else  /* On unix, chown'ing the root directory is not allowed -   * unless you're root, of course.   */  if (geteuid() == 0)    TUV_ASSERT(req->result == 0);  else    TUV_ASSERT(req->result == UV_EPERM);#endif  chown_cb_count++;  uv_fs_req_cleanup(req);}
开发者ID:esevan,项目名称:libtuv,代码行数:17,


示例8: fread_idle_cb

// Called by the by the 'idle' handle to emulate a reading eventstatic void fread_idle_cb(uv_idle_t *handle){    uv_fs_t req;    RStream *rstream = handle->data;    rstream->uvbuf.base = rstream->buffer + rstream->wpos;    rstream->uvbuf.len = rstream->buffer_size - rstream->wpos;    // the offset argument to uv_fs_read is int64_t, could someone really try    // to read more than 9 quintillion (9e18) bytes?    // upcast is meant to avoid tautological condition warning on 32 bits    uintmax_t fpos_intmax = rstream->fpos;    assert(fpos_intmax <= INT64_MAX);    // Synchronous read    uv_fs_read(        uv_default_loop(),        &req,        rstream->fd,        &rstream->uvbuf,        1,        (int64_t) rstream->fpos,        NULL);    uv_fs_req_cleanup(&req);    if (req.result <= 0) {        uv_idle_stop(rstream->fread_idle);        emit_read_event(rstream, true);        return;    }    // no errors (req.result (ssize_t) is positive), it's safe to cast.    size_t nread = (size_t) req.result;    rstream->wpos += nread;    rstream->fpos += nread;    if (rstream->wpos == rstream->buffer_size) {        // The last read filled the buffer, stop reading for now        rstream_stop(rstream);    }    emit_read_event(rstream, false);}
开发者ID:neerajgangwar,项目名称:neovim,代码行数:46,


示例9: fread_idle_cb

// Called by the by the 'idle' handle to emulate a reading eventstatic void fread_idle_cb(uv_idle_t *handle){  uv_fs_t req;  RStream *rstream = handle->data;  rstream->uvbuf.base = rstream->buffer + rstream->wpos;  rstream->uvbuf.len = rstream->buffer_size - rstream->wpos;  // the offset argument to uv_fs_read is int64_t, could someone really try  // to read more than 9 quintillion (9e18) bytes?  // DISABLED TO FIX BROKEN BUILD ON 32bit  // TODO(elmart): Review types to allow assertion  // assert(rstream->fpos <= INT64_MAX);  // Synchronous read  uv_fs_read(      uv_default_loop(),      &req,      rstream->fd,      &rstream->uvbuf,      1,      (int64_t) rstream->fpos,      NULL);  uv_fs_req_cleanup(&req);  if (req.result <= 0) {    uv_idle_stop(rstream->fread_idle);    emit_read_event(rstream, true);    return;  }  // no errors (req.result (ssize_t) is positive), it's safe to cast.  size_t nread = (size_t) req.result;  rstream->wpos += nread;  rstream->fpos += nread;  if (rstream->wpos == rstream->buffer_size) {    // The last read filled the buffer, stop reading for now    rstream_stop(rstream);  }  emit_read_event(rstream, false);}
开发者ID:ataraxer,项目名称:neovim,代码行数:46,


示例10: jl_fs_read_byte

JL_DLLEXPORT int jl_fs_read_byte(int handle){    uv_fs_t req;    char c;    uv_buf_t buf[1];    buf[0].base = &c;    buf[0].len = 1;    int ret = uv_fs_read(jl_io_loop, &req, handle, buf, 1, -1, NULL);    uv_fs_req_cleanup(&req);    switch (ret) {    case -1: return ret;    case  0: jl_eof_error();    case  1: return (int)c;    default:        assert(0 && "jl_fs_read_byte: Invalid return value from uv_fs_read");        return -1;    }}
开发者ID:0,项目名称:julia,代码行数:18,


示例11: open_cb

static void open_cb(uv_fs_t* req) {  int r;  ASSERT(req == &open_req1);  ASSERT(req->fs_type == UV_FS_OPEN);  if (req->result < 0) {    fprintf(stderr, "async open error: %d/n", (int) req->result);    ASSERT(0);  }  open_cb_count++;  ASSERT(req->path);  ASSERT(memcmp(req->path, "test_file2/0", 11) == 0);  uv_fs_req_cleanup(req);  memset(buf, 0, sizeof(buf));  iov = uv_buf_init(buf, sizeof(buf));  r = uv_fs_read(loop, &read_req, open_req1.result, &iov, 1, -1,      read_cb);  ASSERT(r == 0);}
开发者ID:slshaw115,项目名称:node,代码行数:18,


示例12: open_cb

static void open_cb(uv_fs_t* req) {  int r;  TUV_ASSERT(req == &open_req1);  TUV_ASSERT(req->fs_type == UV_FS_OPEN);  if (req->result < 0) {    TDLOG("async open error: %d/n", (int)req->result);    TUV_ASSERT(0);  }  open_cb_count++;  TUV_ASSERT(req->path);  TUV_ASSERT(memcmp(req->path, filename2, strlen(filename2)) == 0);  uv_fs_req_cleanup(req);  memset(buf, 0, sizeof(buf));  iov = uv_buf_init(buf, sizeof(buf));  r = uv_fs_read(loop, &read_req, open_req1.result, &iov, 1, -1, read_cb);  TUV_ASSERT(r == 0);}
开发者ID:esevan,项目名称:libtuv,代码行数:18,


示例13: mch_isdir

/* * return TRUE if "name" is a directory * return FALSE if "name" is not a directory * return FALSE for error */int mch_isdir(const char_u *name){  uv_fs_t request;  int result = uv_fs_stat(uv_default_loop(), &request, (const char*) name, NULL);  uint64_t mode = request.statbuf.st_mode;  uv_fs_req_cleanup(&request);  if (0 != result) {    return FALSE;  }  if (!S_ISDIR(mode)) {    return FALSE;  }  return TRUE;}
开发者ID:EchoLiao,项目名称:neovim,代码行数:23,


示例14: After

static void After(uv_fs_t* req) {  FsReqWrap* req_wrap = static_cast<FsReqWrap*>(req->data);  IOTJS_ASSERT(req_wrap != NULL);  IOTJS_ASSERT(req_wrap->data() == req);  JObject cb = req_wrap->jcallback();  IOTJS_ASSERT(cb.IsFunction());  JArgList jarg(2);  if (req->result < 0) {    JObject jerror(CreateUVException(req->result, "open"));    jarg.Add(jerror);  } else {    jarg.Add(JObject::Null());    switch (req->fs_type) {      case UV_FS_CLOSE:      {        break;      }      case UV_FS_OPEN:      case UV_FS_READ:      case UV_FS_WRITE:      {        JObject arg1(static_cast<int>(req->result));        jarg.Add(arg1);        break;      }      case UV_FS_STAT: {        uv_stat_t s = (req->statbuf);        JObject ret(MakeStatObject(&s));        jarg.Add(ret);        break;      }      default:        jarg.Add(JObject::Null());    }  }  JObject res = MakeCallback(cb, JObject::Null(), jarg);  uv_fs_req_cleanup(req);  delete req_wrap;}
开发者ID:Vincent2015,项目名称:iotjs,代码行数:44,


示例15: req_res_free_file

// #### req res free file// Close the file descriptor.static void req_res_free_file(req_res_t* rr) {    if (rr != NULL){        if (rr->file != 0) {            uv_fs_t close_req;            // `NULL` as callback function makes the call synchron.            if (0 != uv_fs_close(loop, &close_req, rr->file, NULL)) {                fprintf(stderr, "uv_fs_close error/n");            }            uv_fs_req_cleanup(&close_req);        }        else {            /* Do nothing yet.             ToDo: DEBUG msg proposed for later server state.*/        }    }    else {        DEBUG("req_res_free_file error: rr is NULL/n");    }}
开发者ID:rensen1986,项目名称:yamhd-c-libuv,代码行数:21,


示例16: squvco_open

static int squvco_open(sqlite3_vfs *const vfs, char const *const path, sqlite3_file *const file, int const sqflags, int *const outFlags) {	int uvflags = 0;	if(!path) return SQLITE_IOERR;	if(sqflags & SQLITE_OPEN_EXCLUSIVE) uvflags |= O_EXCL;	if(sqflags & SQLITE_OPEN_CREATE) uvflags |= O_CREAT;	if(sqflags & SQLITE_OPEN_READWRITE) uvflags |= O_RDWR;	if(sqflags & SQLITE_OPEN_READONLY) uvflags |= O_RDONLY;	uv_fs_t req = { .data = co_active() };	uv_fs_open(vfs->pAppData->loop, &req, path, uvflags, 0600, fs_cb);	co_switch(vfs->pAppData->yield);	int const result = req.result;	uv_fs_req_cleanup(&req);	if(result < 0) return SQLITE_CANTOPEN;	file->methods = &io_methods;	file->file = result;	file->thread = vfs->pAppData;	file->lockLevel = SQLITE_LOCK_NONE;	return SQLITE_OK;}
开发者ID:andreydelpozo2,项目名称:stronglink,代码行数:19,


示例17: fs_exists

static int fs_exists(lua_State* L) {  FSR__SETUP  const char *path = luaL_checkstring(L, 1);  FSR__SET_OPT_CB(2, on_exists_callback)  uv_fs_stat(loop, req, path, cb);  /* NOTE: remove "object" */  lua_remove(L, 1);  if (LUA_NOREF != holder->threadref) { /* we're in coroutine land */    return lua_yield(L, 0);  } else {/* no coroutines */    if (!cb) {      uv_fs_req_cleanup(req);    }    lua_pushboolean(L, req->result != -1);    return 1;  }  return 0; /* unreachable */}
开发者ID:connectFree,项目名称:lev,代码行数:19,


示例18: assert

void FileRequestBaton::file_read(uv_fs_t *req) {    FileRequestBaton *ptr = (FileRequestBaton *)req->data;    assert(ptr->thread_id == std::this_thread::get_id());    if (req->result < 0 || ptr->canceled || !ptr->request) {        // Stating failed or was canceled. We already have an open file handle        // though, which we'll have to close.        notify_error(req);    } else {        // File was successfully read.        if (ptr->request) {            ptr->request->response = util::make_unique<Response>();            ptr->request->response->code = 200;            ptr->request->response->data = std::move(ptr->body);            ptr->request->notify();        }    }    uv_fs_req_cleanup(req);    uv_fs_close(req->loop, req, ptr->fd, file_closed);}
开发者ID:fourks,项目名称:mapbox-gl-native,代码行数:21,


示例19: fread_idle_cb

// Called by the by the 'idle' handle to emulate a reading eventstatic void fread_idle_cb(uv_idle_t *handle){  uv_fs_t req;  RStream *rstream = handle_get_rstream((uv_handle_t *)handle);  rstream->uvbuf.len = rbuffer_available(rstream->buffer);  rstream->uvbuf.base = rbuffer_write_ptr(rstream->buffer);  // the offset argument to uv_fs_read is int64_t, could someone really try  // to read more than 9 quintillion (9e18) bytes?  // upcast is meant to avoid tautological condition warning on 32 bits  uintmax_t fpos_intmax = rstream->fpos;  if (fpos_intmax > INT64_MAX) {    ELOG("stream offset overflow");    preserve_exit();  }  // Synchronous read  uv_fs_read(      uv_default_loop(),      &req,      rstream->fd,      &rstream->uvbuf,      1,      (int64_t) rstream->fpos,      NULL);  uv_fs_req_cleanup(&req);  if (req.result <= 0) {    uv_idle_stop(rstream->fread_idle);    return;  }  // no errors (req.result (ssize_t) is positive), it's safe to cast.  size_t nread = (size_t) req.result;  rbuffer_produced(rstream->buffer, nread);  rstream->fpos += nread;}
开发者ID:axblount,项目名称:neovim,代码行数:40,


示例20: check_permission

static void check_permission(const char* filename, unsigned int mode) {  int r;  uv_fs_t req;  uv_stat_t* s;  r = uv_fs_stat(NULL, &req, filename, NULL);  ASSERT(r == 0);  ASSERT(req.result == 0);  s = &req.statbuf;#ifdef _WIN32  /*   * On Windows, chmod can only modify S_IWUSR (_S_IWRITE) bit,   * so only testing for the specified flags.   */  ASSERT((s->st_mode & 0777) & mode);#else  ASSERT((s->st_mode & 0777) == mode);#endif  uv_fs_req_cleanup(&req);}
开发者ID:slshaw115,项目名称:node,代码行数:22,


示例21: check_permission

void check_permission(const char* filename, int mode) {  int r;  uv_fs_t req;  struct stat* s;  r = uv_fs_stat(uv_default_loop(), &req, filename, NULL);  ASSERT(r == 0);  ASSERT(req.result == 0);  s = req.ptr;#ifdef _WIN32  /*    * On Windows, chmod can only modify S_IWUSR (_S_IWRITE) bit,   * so only testing for the specified flags.   */  ASSERT((s->st_mode & 0777) & mode);#else  ASSERT((s->st_mode & 0777) == mode);#endif  uv_fs_req_cleanup(&req);}
开发者ID:amuxtux,项目名称:libuv,代码行数:22,


示例22: after_write_logger_and_close_cb

void after_write_logger_and_close_cb(uv_fs_t* req){	int r;	uv_fs_t* close_req;	css_logger_write_req_t *wreq = (css_logger_write_req_t*) req->data;	css_logger_writer_t *writer = wreq->writer;	if (req->result < 0) {		printf("writer last data to log %s error:%s./n", wreq->writer->path, uv_strerror((int) req->result));	}	uv_fs_req_cleanup(req);	FREE(wreq);	FREE(req);	close_req = (uv_fs_t*) malloc(sizeof(uv_fs_t));	close_req->data = writer;	r = uv_fs_close(css_logger.loop, close_req, writer->fd, after_roll_logger_cb);	if (r < 0) {		printf("close file %s error:%s /n", writer->path, uv_strerror((int) req->result));		FREE(writer);		FREE(close_req);	}}
开发者ID:zhifeichen,项目名称:libcapture,代码行数:22,


示例23: luv_fs_cb

static void luv_fs_cb(uv_fs_t* req) {  lua_State* L = luv_state(req->loop);  int nargs = push_fs_result(L, req);  if (nargs == 2 && lua_isnil(L, -nargs)) {    // If it was an error, convert to (err, value) format.    lua_remove(L, -nargs);    nargs--;  }  else {    // Otherwise insert a nil in front to convert to (err, value) format.    lua_pushnil(L);    lua_insert(L, -nargs - 1);    nargs++;  }  luv_fulfill_req(L, req->data, nargs);  if (req->fs_type != UV_FS_SCANDIR) {    luv_cleanup_req(L, req->data);    req->data = NULL;    uv_fs_req_cleanup(req);  }}
开发者ID:kidaa,项目名称:luv,代码行数:22,


示例24: on_read

void on_read(uv_fs_t* req){    ssize_t size_read = req->result;    read_write_op_t* read_write_op = req->data;    uv_fs_req_cleanup(req);    if (size_read < 0)    {        fprintf(stderr, "Error when reading: %s/n", uv_strerror(uv_last_error(uv_default_loop())));    }    else if (size_read == 0)    {        uv_fs_t close_req;        if (read_write_op && read_write_op->buff)        {            free(read_write_op->buff);            read_write_op->buff = NULL;        }        uv_fs_close(uv_default_loop(), &close_req, read_write_op->read_fd, NULL);    }    else    {        uv_fs_t     write_req;        write_req.data = read_write_op;        uv_fs_write(uv_default_loop(),                    &write_req,                    1,                    read_write_op->buff,                    size_read,                    -1,                    on_write);    }}
开发者ID:misterdjules,项目名称:libuv-book-samples,代码行数:37,


示例25: pipe_echo_start

static int pipe_echo_start(char* pipeName) {  int r;#ifndef _WIN32  {    uv_fs_t req;    uv_fs_unlink(uv_default_loop(), &req, pipeName, NULL);    uv_fs_req_cleanup(&req);  }#endif  server = (uv_handle_t*)&pipeServer;  serverType = PIPE;  r = uv_pipe_init(loop, &pipeServer, 0);  if (r) {    fprintf(stderr, "uv_pipe_init: %s/n",        uv_strerror(uv_last_error(loop)));    return 1;  }  r = uv_pipe_bind(&pipeServer, pipeName);  if (r) {    fprintf(stderr, "uv_pipe_bind: %s/n",        uv_strerror(uv_last_error(loop)));    return 1;  }  r = uv_listen((uv_stream_t*)&pipeServer, SOMAXCONN, on_connection);  if (r) {    fprintf(stderr, "uv_pipe_listen: %s/n",        uv_strerror(uv_last_error(loop)));    return 1;  }  return 0;}
开发者ID:2hanson,项目名称:node,代码行数:37,


示例26: check_utime

static void check_utime(const char* path, double atime, double mtime) {  struct stat* s;  uv_fs_t req;  int r;  r = uv_fs_stat(loop, &req, path, NULL);  ASSERT(r == 0);  ASSERT(req.result == 0);  s = req.ptr;#if _WIN32  ASSERT(s->st_atime == atime);  ASSERT(s->st_mtime == mtime);#elif !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)  ASSERT(s->st_atimespec.tv_sec  == atime);  ASSERT(s->st_mtimespec.tv_sec  == mtime);#else  ASSERT(s->st_atim.tv_sec  == atime);  ASSERT(s->st_mtim.tv_sec  == mtime);#endif  uv_fs_req_cleanup(&req);}
开发者ID:MikesUptown,项目名称:node,代码行数:24,


示例27: on_write

void on_write(uv_fs_t* req){    read_write_op_t* read_write_op = req->data;    uv_fs_req_cleanup(req);    if (req->result < 0)    {        fprintf(stderr, "Error when writing: %s/n", uv_strerror(uv_last_error(uv_default_loop())));    }    else    {        uv_fs_t read_req;        read_req.data = read_write_op;        uv_fs_read(uv_default_loop(),                   &read_req,                   read_write_op->read_fd,                   read_write_op->buff,                   BUFFER_LEN,                   -1,                   on_read);    }}
开发者ID:misterdjules,项目名称:libuv-book-samples,代码行数:24,


示例28: on_fs_read

static voidon_fs_read(uv_fs_t *req) {  http_response* response = (http_response*) req->data;  int result = req->result;  uv_fs_req_cleanup(req);  if (result < 0) {    fprintf(stderr, "File read error: %s: %s/n", uv_err_name(result), uv_strerror(result));    response_error(response->handle, 500, "Internal Server Error", NULL);    destroy_response(response, 1);    return;  } else if (result == 0) {    destroy_response(response, 1);    return;  }  uv_buf_t buf = uv_buf_init(response->pbuf, result);  int r = uv_write(&response->write_req, (uv_stream_t*) response->handle, &buf, 1, on_write);  if (r) {    destroy_response(response, 1);    return;  }  response->response_offset += result;}
开发者ID:takehiakihiro,项目名称:http-server,代码行数:24,


示例29: open_loop_cb

static void open_loop_cb(uv_fs_t* req) {  TUV_ASSERT(req->fs_type == UV_FS_OPEN);  TUV_ASSERT(req->result == UV_ELOOP);  open_cb_count++;  uv_fs_req_cleanup(req);}
开发者ID:esevan,项目名称:libtuv,代码行数:6,



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


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