本文整理汇总了C++中JL_SIGATOMIC_END函数的典型用法代码示例。如果您正苦于以下问题:C++ JL_SIGATOMIC_END函数的具体用法?C++ JL_SIGATOMIC_END怎么用?C++ JL_SIGATOMIC_END使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了JL_SIGATOMIC_END函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: jl_putc
DLLEXPORT int jl_putc(unsigned char c, uv_stream_t *stream)
{
if (stream!=0) {
if (stream->type<UV_HANDLE_TYPE_MAX) { //is uv handle
if (stream->type == UV_FILE) {
JL_SIGATOMIC_BEGIN();
jl_uv_file_t *file = (jl_uv_file_t *)stream;
// Do a blocking write for now
uv_fs_t req;
int err = uv_fs_write(file->loop, &req, file->file, &c, 1, -1, NULL);
JL_SIGATOMIC_END();
return err ? 0 : 1;
}
else {
JL_SIGATOMIC_BEGIN();
uv_write_t *uvw = malloc(sizeof(uv_write_t) + 1);
char *data = (char*)(uvw+1);
*data = c;
uv_buf_t buf[] = {{.base = data,.len=1}};
uvw->data = data;
int err = uv_write(uvw,stream,buf,1,&jl_free_buffer);
JL_SIGATOMIC_END();
return err ? 0 : 1;
}
}
else {
示例2: jl_putc
DLLEXPORT int jl_putc(char c, uv_stream_t *stream)
{
int err;
if (stream!=0) {
if (stream->type<UV_HANDLE_TYPE_MAX) { //is uv handle
if (stream->type == UV_FILE) {
JL_SIGATOMIC_BEGIN();
jl_uv_file_t *file = (jl_uv_file_t *)stream;
// Do a blocking write for now
uv_fs_t req;
uv_buf_t buf[1];
buf[0].base = &c;
buf[0].len = 1;
err = uv_fs_write(file->loop, &req, file->file, buf, 1, -1, NULL);
JL_SIGATOMIC_END();
return err ? 0 : 1;
}
else {
uv_write_t *uvw = (uv_write_t*)malloc(sizeof(uv_write_t)+1);
err = jl_write_copy(stream,(char*)&c,1,uvw, (void*)&jl_uv_writecb);
if (err < 0) {
free(uvw);
return 0;
}
return 1;
}
}
else {
ios_t *handle = (ios_t*)stream;
return ios_putc(c,handle);
}
}
return 0;
}
示例3: jl_write
DLLEXPORT size_t jl_write(uv_stream_t *stream, const char *str, size_t n)
{
int err;
//TODO: BAD!! Needed because Julia can't yet detect null stdio
if (stream == 0)
return 0;
if (stream->type<UV_HANDLE_TYPE_MAX) { //is uv handle
if (stream->type == UV_FILE) {
JL_SIGATOMIC_BEGIN();
jl_uv_file_t *file = (jl_uv_file_t *)stream;
// Do a blocking write for now
uv_fs_t req;
uv_buf_t buf[1];
buf[0].base = (char*)str;
buf[0].len = n;
err = uv_fs_write(file->loop, &req, file->file, buf, 1, -1, NULL);
JL_SIGATOMIC_END();
return err ? 0 : n;
}
else {
uv_write_t *uvw = (uv_write_t*)malloc(sizeof(uv_write_t)+n);
err = jl_write_copy(stream,str,n,uvw, (void*)&jl_uv_writecb);
if (err < 0) {
free(uvw);
return 0;
}
return n;
}
}
else {
ios_t *handle = (ios_t*)stream;
return ios_write(handle,str,n);
}
}
示例4: jl_sigatomic_end
JL_DLLEXPORT void jl_sigatomic_end(void)
{
jl_ptls_t ptls = jl_get_ptls_states();
if (ptls->defer_signal == 0)
jl_error("sigatomic_end called in non-sigatomic region");
JL_SIGATOMIC_END();
}
示例5: jl_gc_collect
void jl_gc_collect(void)
{
size_t actual_allocd = allocd_bytes;
total_allocd_bytes += allocd_bytes;
allocd_bytes = 0;
if (is_gc_enabled) {
JL_SIGATOMIC_BEGIN();
jl_in_gc = 1;
#if defined(GCTIME) || defined(GC_FINAL_STATS)
double t0 = clock_now();
#endif
gc_mark();
#ifdef GCTIME
JL_PRINTF(JL_STDERR, "mark time %.3f ms\n", (clock_now()-t0)*1000);
#endif
#if defined(MEMPROFILE)
all_pool_stats();
big_obj_stats();
#endif
#ifdef GCTIME
t0 = clock_now();
#endif
sweep_weak_refs();
gc_sweep();
#ifdef GCTIME
JL_PRINTF(JL_STDERR, "sweep time %.3f ms\n", (clock_now()-t0)*1000);
#endif
int nfinal = to_finalize.len;
run_finalizers();
jl_in_gc = 0;
JL_SIGATOMIC_END();
#if defined(GC_FINAL_STATS)
total_gc_time += (clock_now()-t0);
total_freed_bytes += freed_bytes;
#endif
#ifdef OBJPROFILE
print_obj_profile();
htable_reset(&obj_counts, 0);
#endif
// tune collect interval based on current live ratio
#if defined(MEMPROFILE)
jl_printf(JL_STDERR, "allocd %ld, freed %ld, interval %ld, ratio %.2f\n",
actual_allocd, freed_bytes, collect_interval,
(double)freed_bytes/(double)actual_allocd);
#endif
if (freed_bytes < (7*(actual_allocd/10))) {
if (collect_interval <= 2*(max_collect_interval/5))
collect_interval = 5*(collect_interval/2);
}
else {
collect_interval = default_collect_interval;
}
freed_bytes = 0;
// if a lot of objects were finalized, re-run GC to finish freeing
// their storage if possible.
if (nfinal > 100000)
jl_gc_collect();
}
}
示例6: jl_gc_collect
void jl_gc_collect(void)
{
allocd_bytes = 0;
if (is_gc_enabled) {
JL_SIGATOMIC_BEGIN();
#ifdef GCTIME
double t0 = clock_now();
#endif
gc_mark();
#ifdef GCTIME
ios_printf(ios_stderr, "mark time %.3f ms\n", (clock_now()-t0)*1000);
#endif
#if defined(MEMPROFILE)
all_pool_stats();
big_obj_stats();
#endif
#ifdef GCTIME
t0 = clock_now();
#endif
sweep_weak_refs();
gc_sweep();
#ifdef GCTIME
ios_printf(ios_stderr, "sweep time %.3f ms\n", (clock_now()-t0)*1000);
#endif
run_finalizers();
JL_SIGATOMIC_END();
#ifdef OBJPROFILE
print_obj_profile();
htable_reset(&obj_counts, 0);
#endif
}
}
示例7: jl_fs_rename
JL_DLLEXPORT int jl_fs_rename(const char *src_path, const char *dst_path)
{
uv_fs_t req;
JL_SIGATOMIC_BEGIN();
int ret = uv_fs_rename(jl_io_loop, &req, src_path, dst_path, NULL);
uv_fs_req_cleanup(&req);
JL_SIGATOMIC_END();
return ret;
}
示例8: jl_fs_unlink
JL_DLLEXPORT int jl_fs_unlink(char *path)
{
uv_fs_t req;
JL_SIGATOMIC_BEGIN();
int ret = uv_fs_unlink(jl_io_loop, &req, path, NULL);
uv_fs_req_cleanup(&req);
JL_SIGATOMIC_END();
return ret;
}
示例9: jl_uv_write
DLLEXPORT int jl_uv_write(uv_stream_t *stream, const char *data, size_t n, uv_write_t *uvw, void *writecb)
{
uv_buf_t buf[1];
buf[0].base = (char*)data;
buf[0].len = n;
JL_SIGATOMIC_BEGIN();
int err = uv_write(uvw,stream,buf,1,(uv_write_cb)writecb);
JL_SIGATOMIC_END();
return err;
}
示例10: jl_fs_sendfile
JL_DLLEXPORT int jl_fs_sendfile(int src_fd, int dst_fd,
int64_t in_offset, size_t len)
{
uv_fs_t req;
JL_SIGATOMIC_BEGIN();
int ret = uv_fs_sendfile(jl_io_loop, &req, dst_fd, src_fd,
in_offset, len, NULL);
uv_fs_req_cleanup(&req);
JL_SIGATOMIC_END();
return ret;
}
示例11: jl_write_no_copy
DLLEXPORT int jl_write_no_copy(uv_stream_t *stream, char *data, size_t n, uv_write_t *uvw, void *writecb)
{
uv_buf_t buf[1];
buf[0].base = data;
buf[0].len = n;
JL_SIGATOMIC_BEGIN();
int err = uv_write(uvw,stream,buf,1,(uv_write_cb)writecb);
uvw->data = NULL;
JL_SIGATOMIC_END();
return err;
}
示例12: jl_ast_ctx_leave
static void jl_ast_ctx_leave(jl_ast_context_t *ctx)
{
JL_SIGATOMIC_END();
if (--ctx->ref)
return;
JL_LOCK_NOGC(&flisp_lock);
ctx->task = NULL;
jl_ast_context_list_t *node = &ctx->list;
jl_ast_context_list_delete(node);
jl_ast_context_list_insert(&jl_ast_ctx_freed, node);
JL_UNLOCK_NOGC(&flisp_lock);
}
示例13: jl_enter_handler
void jl_enter_handler(jl_handler_t *eh)
{
JL_SIGATOMIC_BEGIN();
eh->prev = jl_current_task->eh;
#ifdef JL_GC_MARKSWEEP
eh->gcstack = jl_pgcstack;
#endif
jl_current_task->eh = eh;
// TODO: this should really go after setjmp(). see comment in
// ctx_switch in task.c.
JL_SIGATOMIC_END();
}
示例14: jl_putc
DLLEXPORT int jl_putc(unsigned char c, uv_stream_t *stream)
{
if (stream!=0) {
if (stream->type<UV_HANDLE_TYPE_MAX) { //is uv handle
JL_SIGATOMIC_BEGIN();
uv_write_t *uvw = malloc(sizeof(uv_write_t));
uvw->data=0;
uv_buf_t buf[] = {{.base = chars+c,.len=1}};
int err = uv_write(uvw,stream,buf,1,&jl_free_buffer);
JL_SIGATOMIC_END();
return err ? 0 : 1;
}
示例15: jl_write_copy
DLLEXPORT int jl_write_copy(uv_stream_t *stream, const char *str, size_t n, uv_write_t *uvw, void *writecb)
{
JL_SIGATOMIC_BEGIN();
char *data = (char*)(uvw+1);
memcpy(data,str,n);
uv_buf_t buf[1];
buf[0].base = data;
buf[0].len = n;
uvw->data = NULL;
int err = uv_write(uvw,stream,buf,1,(uv_write_cb)writecb);
JL_SIGATOMIC_END();
return err;
}