Example #1
0
static sexp sexp_make_pollfds (sexp ctx) {
  sexp res = sexp_alloc_tagged(ctx, sexp_sizeof_pollfds, sexp_unbox_fixnum(sexp_global(ctx, SEXP_G_THREADS_POLLFDS_ID)));
  sexp_pollfds_fds(res) = malloc(SEXP_INIT_POLLFDS_MAX_FDS * sizeof(struct pollfd));
  sexp_pollfds_num_fds(res) = 0;
  sexp_pollfds_max_fds(res) = SEXP_INIT_POLLFDS_MAX_FDS;
  return res;
}
Example #2
0
static sexp sexp_make_pollfds (sexp ctx) {
  sexp res = sexp_alloc_tagged(ctx, sexp_sizeof_pollfds, sexp_pollfds_id);
  sexp_pollfds_fds(res) = malloc(SEXP_INIT_POLLFDS_MAX_FDS * sizeof(struct pollfd));
  sexp_pollfds_num_fds(res) = 0;
  sexp_pollfds_max_fds(res) = SEXP_INIT_POLLFDS_MAX_FDS;
  return res;
}
Example #3
0
static sexp sexp_free_pollfds (sexp ctx, sexp self, sexp_sint_t n, sexp pollfds) {
  if (sexp_pollfds_fds(pollfds)) {
    free(sexp_pollfds_fds(pollfds));
    sexp_pollfds_fds(pollfds) = NULL;
    sexp_pollfds_num_fds(pollfds) = 0;
    sexp_pollfds_max_fds(pollfds) = 0;
  }
  return SEXP_VOID;
}
Example #4
0
static sexp sexp_free_pollfds (sexp ctx sexp_api_params(self, n), sexp pollfds) {
  if (sexp_pollfds_fds(pollfds)) {
    free(sexp_pollfds_fds(pollfds));
    sexp_pollfds_fds(pollfds) = NULL;
    sexp_pollfds_num_fds(pollfds) = 0;
    sexp_pollfds_max_fds(pollfds) = 0;
  }
  return SEXP_VOID;
}