当前位置: 首页>>代码示例>>C++>>正文


C++ caml_leave_blocking_section函数代码示例

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


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

示例1: caml_seek_in

CAMLexport void caml_seek_in(struct channel *channel, file_offset dest)
{
  if (dest >= channel->offset - (channel->max - channel->buff) &&
      dest <= channel->offset) {
    channel->curr = channel->max - (channel->offset - dest);
  } else {
    caml_sys_error(NO_ARG);
    caml_leave_blocking_section();
    channel->offset = dest;
    channel->curr = channel->max = channel->buff;
  }
}
开发者ID:pgj,项目名称:mirage-platform,代码行数:12,代码来源:io.c

示例2: ocaml_ssl_set_client_SNI_hostname

CAMLprim value ocaml_ssl_set_client_SNI_hostname(value socket, value vhostname)
{
  CAMLparam2(socket, vhostname);
  SSL *ssl       = SSL_val(socket);
  char *hostname = String_val(vhostname);

  caml_enter_blocking_section();
  SSL_set_tlsext_host_name(ssl, hostname);
  caml_leave_blocking_section();

  CAMLreturn(Val_unit);
}
开发者ID:marcolinoas,项目名称:libres3,代码行数:12,代码来源:ssl_stubs.c

示例3: ocaml_ssl_get_issuer

CAMLprim value ocaml_ssl_get_issuer(value certificate)
{
  CAMLparam1(certificate);
  X509 *cert = Cert_val(certificate);

  caml_enter_blocking_section();
  char *issuer = X509_NAME_oneline(X509_get_issuer_name(cert), 0, 0);
  caml_leave_blocking_section();
  if (!issuer) caml_raise_not_found ();

  CAMLreturn(caml_copy_string(issuer));
}
开发者ID:marcolinoas,项目名称:libres3,代码行数:12,代码来源:ssl_stubs.c

示例4: ocaml_ssl_get_file_descr

CAMLprim value ocaml_ssl_get_file_descr(value socket)
{
  CAMLparam1(socket);
  SSL *ssl = SSL_val(socket);
  int fd;

  caml_enter_blocking_section();
  fd = SSL_get_fd(ssl);
  caml_leave_blocking_section();

  CAMLreturn(Val_int(fd));
}
开发者ID:marcolinoas,项目名称:libres3,代码行数:12,代码来源:ssl_stubs.c

示例5: ocaml_ssl_get_subject

CAMLprim value ocaml_ssl_get_subject(value certificate)
{
  CAMLparam1(certificate);
  X509 *cert = Cert_val(certificate);

  caml_enter_blocking_section();
  char *subject = X509_NAME_oneline(X509_get_subject_name(cert), 0, 0);
  caml_leave_blocking_section();
  if (subject == NULL) caml_raise_not_found ();

  CAMLreturn(caml_copy_string(subject));
}
开发者ID:marcolinoas,项目名称:libres3,代码行数:12,代码来源:ssl_stubs.c

示例6: ocaml_ssl_get_verify_result

CAMLprim value ocaml_ssl_get_verify_result(value socket)
{
  CAMLparam1(socket);
  int ans;
  SSL *ssl = SSL_val(socket);

  caml_enter_blocking_section();
  ans = SSL_get_verify_result(ssl);
  caml_leave_blocking_section();

  CAMLreturn(Val_int(ans));
}
开发者ID:marcolinoas,项目名称:libres3,代码行数:12,代码来源:ssl_stubs.c

示例7: caml_do_read

/* caml_do_read is exported for Cash */
CAMLexport int caml_do_read(int fd, char *p, unsigned int n)
{
  int retcode;

  do {
    caml_enter_blocking_section();
    retcode = read(fd, p, n);
    caml_leave_blocking_section();
  } while (retcode == -1 && errno == EINTR);
  if (retcode == -1) caml_sys_io_error(NO_ARG);
  return retcode;
}
开发者ID:joechenq,项目名称:multi-script,代码行数:13,代码来源:ocaml_io.c

示例8: unix_fstat

CAMLprim value unix_fstat(value fd)
{
  int ret;
  struct stat buf;
  caml_enter_blocking_section();
  ret = fstat(Int_val(fd), &buf);
  caml_leave_blocking_section();
  if (ret == -1) uerror("fstat", Nothing);
  if (buf.st_size > Max_long && (buf.st_mode & S_IFMT) == S_IFREG)
    unix_error(EOVERFLOW, "fstat", Nothing);
  return stat_aux(0, &buf);
}
开发者ID:bluddy,项目名称:ocaml-multicore,代码行数:12,代码来源:stat.c

示例9: bigstring_write_stub

CAMLprim value bigstring_write_stub(
  value v_fd, value v_pos, value v_len, value v_bstr)
{
  CAMLparam1(v_bstr);
  char *bstr = get_bstr(v_bstr, v_pos);
  size_t len = Long_val(v_len);
  ssize_t written;
  caml_enter_blocking_section();
    written = write(Int_val(v_fd), bstr, len);
  caml_leave_blocking_section();
  if (written == -1) uerror("write", Nothing);
  CAMLreturn(Val_long(written));
}
开发者ID:commonlisp,项目名称:core,代码行数:13,代码来源:bigstring_stubs.c

示例10: lo_write_ba_stub

CAMLprim value lo_write_ba_stub(value v_conn, value v_fd,
                                value v_buf, value v_pos, value v_len)
{
  CAMLparam2(v_conn, v_buf);
  PGconn *conn = get_conn(v_conn);
  value v_res;
  size_t len = Long_val(v_len);
  char *buf = ((char *) Caml_ba_data_val(v_buf)) + Long_val(v_pos);
  caml_enter_blocking_section();
    v_res = Val_long(lo_write(conn, Int_val(v_fd), buf, len));
  caml_leave_blocking_section();
  CAMLreturn(v_res);
}
开发者ID:Nevor,项目名称:postgresql-ocaml,代码行数:13,代码来源:postgresql_stubs.c

示例11: svn_pool_create

apr_array_header_t *svn_support_diff(char *rep_path, 
                                    char *filename, 
                                    int revision1, 
                                    int revision2)
{
  apr_pool_t *subpool = svn_pool_create(pool);
  svn_stringbuf_t * rep = svn_stringbuf_create(rep_path, subpool);
  svn_stringbuf_t * file = svn_stringbuf_create(filename, subpool);
  caml_enter_blocking_section ();
  apr_array_header_t *res = svn_support_diff_call(rep->data,file->data,revision1,revision2,subpool); 
  caml_leave_blocking_section ();
  return res;
}
开发者ID:aryx,项目名称:fork-ocsigen,代码行数:13,代码来源:swig_svn.c

示例12: ocaml_ssl_ctx_load_verify_locations

CAMLprim value ocaml_ssl_ctx_load_verify_locations(value context, value ca_file, value ca_path)
{
  CAMLparam3(context, ca_file, ca_path);
  SSL_CTX *ctx = Ctx_val(context);
  char *CAfile = String_val(ca_file);
  char *CApath = String_val(ca_path);

  if(*CAfile == 0)
    CAfile = NULL;
  if(*CApath == 0)
    CApath = NULL;

  caml_enter_blocking_section();
  if(SSL_CTX_load_verify_locations(ctx, CAfile, CApath) != 1)
  {
    caml_leave_blocking_section();
    caml_invalid_argument("cafile or capath");
  }
  caml_leave_blocking_section();

  CAMLreturn(Val_unit);
}
开发者ID:marcolinoas,项目名称:libres3,代码行数:22,代码来源:ssl_stubs.c

示例13: ocaml_ssl_write_certificate

CAMLprim value ocaml_ssl_write_certificate(value vfilename, value certificate)
{
  CAMLparam2(vfilename, certificate);
  char *filename = String_val(vfilename);
  X509 *cert = Cert_val(certificate);
  FILE *fh = NULL;

  if((fh = fopen(filename, "w")) == NULL)
    caml_raise_constant(*caml_named_value("ssl_exn_certificate_error"));

  caml_enter_blocking_section();
  if(PEM_write_X509(fh, cert) == 0)
  {
    fclose(fh);
    caml_leave_blocking_section();
    caml_raise_constant(*caml_named_value("ssl_exn_certificate_error"));
  }
  fclose(fh);
  caml_leave_blocking_section();

  CAMLreturn(Val_unit);
}
开发者ID:marcolinoas,项目名称:libres3,代码行数:22,代码来源:ssl_stubs.c

示例14: ocaml_ssl_get_current_cipher

CAMLprim value ocaml_ssl_get_current_cipher(value socket)
{
  CAMLparam1(socket);
  SSL *ssl = SSL_val(socket);

  caml_enter_blocking_section();
  SSL_CIPHER *cipher = (SSL_CIPHER*)SSL_get_current_cipher(ssl);
  caml_leave_blocking_section();
  if (!cipher)
    caml_raise_constant(*caml_named_value("ssl_exn_cipher_error"));

  CAMLreturn((value)cipher);
}
开发者ID:marcolinoas,项目名称:libres3,代码行数:13,代码来源:ssl_stubs.c

示例15: unix_unlink

CAMLprim value unix_unlink(value path)
{
  CAMLparam1(path);
  char * p;
  int ret;
  p = caml_strdup(String_val(path));
  caml_enter_blocking_section();
  ret = unlink(p);
  caml_leave_blocking_section();
  caml_stat_free(p);
  if (ret == -1) uerror("unlink", path);
  CAMLreturn(Val_unit);
}
开发者ID:BrianMulhall,项目名称:ocaml,代码行数:13,代码来源:unlink.c


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