本文整理汇总了C++中JL_SIGATOMIC_END函数的典型用法代码示例。如果您正苦于以下问题:C++ JL_SIGATOMIC_END函数的具体用法?C++ JL_SIGATOMIC_END怎么用?C++ JL_SIGATOMIC_END使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了JL_SIGATOMIC_END函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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 {
开发者ID:BusyAge,项目名称:julia,代码行数:26,代码来源:jl_uv.c
示例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;
}
开发者ID:jskDr,项目名称:julia,代码行数:34,代码来源:jl_uv.c
示例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);
}
}
开发者ID:jskDr,项目名称:julia,代码行数:34,代码来源:jl_uv.c
示例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();
}
开发者ID:iglpdc,项目名称:julia,代码行数:7,代码来源:jlapi.c
示例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();
}
}
开发者ID:JHonaker,项目名称:julia,代码行数:60,代码来源:gc.c
示例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
}
}
开发者ID:ChappedSky,项目名称:julia,代码行数:32,代码来源:gc.c
示例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;
}
开发者ID:0,项目名称:julia,代码行数:9,代码来源:jl_uv.c
示例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;
}
开发者ID:0,项目名称:julia,代码行数:9,代码来源:jl_uv.c
示例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;
}
开发者ID:Wilfred,项目名称:julia,代码行数:10,代码来源:jl_uv.c
示例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;
}
开发者ID:0,项目名称:julia,代码行数:11,代码来源:jl_uv.c
示例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;
}
开发者ID:jskDr,项目名称:julia,代码行数:11,代码来源:jl_uv.c
示例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);
}
开发者ID:ararslan,项目名称:julia,代码行数:12,代码来源:ast.c
示例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();
}
开发者ID:aviks,项目名称:julia,代码行数:12,代码来源:builtins.c
示例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;
}
开发者ID:pridkett,项目名称:julia,代码行数:12,代码来源:jl_uv.c
示例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;
}
开发者ID:jskDr,项目名称:julia,代码行数:13,代码来源:jl_uv.c
示例16: jl_uv_puts
JL_DLLEXPORT void jl_uv_puts(uv_stream_t *stream, const char *str, size_t n)
{
assert(stream);
static_assert(offsetof(uv_stream_t,type) == offsetof(ios_t,bm) &&
sizeof(((uv_stream_t*)0)->type) == sizeof(((ios_t*)0)->bm),
"UV and ios layout mismatch");
uv_file fd = 0;
// Fallback for output during early initialisation...
if (stream == (void*)STDOUT_FILENO || stream == (void*)STDERR_FILENO) {
if (!jl_io_loop) jl_io_loop = uv_default_loop();
fd = (uv_file)(size_t)stream;
}
else if (stream->type == UV_FILE) {
fd = ((jl_uv_file_t*)stream)->file;
}
if (fd) {
// Write to file descriptor...
jl_fs_write(fd, str, n, -1);
}
else if (stream->type > UV_HANDLE_TYPE_MAX) {
// Write to ios.c stream...
// This is needed because caller jl_static_show() in builtins.c can be
// called from fl_print in flisp/print.c (via cvalue_printdata()),
// and cvalue_printdata() passes ios_t* to jl_static_show().
ios_write((ios_t*)stream, str, n);
}
else {
// Write to libuv stream...
uv_write_t *req = (uv_write_t*)malloc(sizeof(uv_write_t)+n);
char *data = (char*)(req+1);
memcpy(data,str,n);
uv_buf_t buf[1];
buf[0].base = data;
buf[0].len = n;
req->data = NULL;
JL_SIGATOMIC_BEGIN();
int status = uv_write(req, stream, buf, 1, (uv_write_cb)jl_uv_writecb);
JL_SIGATOMIC_END();
if (status < 0) {
jl_uv_writecb(req, status);
}
}
}
开发者ID:0,项目名称:julia,代码行数:46,代码来源:jl_uv.c
示例17: jl_gc_collect
void jl_gc_collect(void)
{
allocd_bytes = 0;
if (is_gc_enabled) {
freed_bytes = 0;
JL_SIGATOMIC_BEGIN();
#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
run_finalizers();
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 (freed_bytes < ((2*collect_interval)/5)) {
if (collect_interval <= (2*max_collect_interval)/5)
collect_interval = (5*collect_interval)/2;
}
else {
collect_interval = default_collect_interval;
}
}
}
开发者ID:wlbksy,项目名称:julia,代码行数:46,代码来源:gc.c
示例18: jl_enter_handler
void jl_enter_handler(jl_savestate_t *ss, jmp_buf *handlr)
{
JL_SIGATOMIC_BEGIN();
ss->eh_task = jl_current_task->state.eh_task;
ss->eh_ctx = jl_current_task->state.eh_ctx;
ss->ostream_obj = jl_current_task->state.ostream_obj;
ss->current_output_stream = jl_current_task->state.current_output_stream;
ss->prev = jl_current_task->state.prev;
#ifdef JL_GC_MARKSWEEP
ss->gcstack = jl_pgcstack;
#endif
jl_current_task->state.prev = ss;
jl_current_task->state.eh_task = jl_current_task;
jl_current_task->state.eh_ctx = handlr;
// TODO: this should really go after setjmp(). see comment in
// ctx_switch in task.c.
JL_SIGATOMIC_END();
}
开发者ID:AnthonyNystrom,项目名称:julia,代码行数:19,代码来源:builtins.c
示例19: jl_typemap_list_insert_sorted
static void jl_typemap_list_insert_sorted(jl_typemap_entry_t **pml, jl_value_t *parent,
jl_typemap_entry_t *newrec,
const struct jl_typemap_info *tparams)
{
jl_typemap_entry_t *l, **pl;
pl = pml;
l = *pml;
jl_value_t *pa = parent;
while (l != (void*)jl_nothing) {
if (!l->isleafsig) {
if (jl_args_morespecific((jl_value_t*)newrec->sig, (jl_value_t*)l->sig))
break;
}
pl = &l->next;
pa = (jl_value_t*)l;
l = l->next;
}
JL_SIGATOMIC_BEGIN();
newrec->next = l;
jl_gc_wb(newrec, l);
*pl = newrec;
jl_gc_wb(pa, newrec);
// if this contains Union types, methods after it might actually be
// more specific than it. we need to re-sort them.
if (has_unions(newrec->sig)) {
jl_value_t *item_parent = (jl_value_t*)newrec;
jl_value_t *next_parent = 0;
jl_typemap_entry_t *item = newrec->next, *next;
jl_typemap_entry_t **pitem = &newrec->next, **pnext;
while (item != (void*)jl_nothing) {
pl = pml;
l = *pml;
pa = parent;
next = item->next;
pnext = &item->next;
next_parent = (jl_value_t*)item;
while (l != newrec->next) {
if (jl_args_morespecific((jl_value_t*)item->sig,
(jl_value_t*)l->sig)) {
// reinsert item earlier in the list
*pitem = next;
jl_gc_wb(item_parent, next);
item->next = l;
jl_gc_wb(item, item->next);
*pl = item;
jl_gc_wb(pa, item);
pnext = pitem;
next_parent = item_parent;
break;
}
pl = &l->next;
pa = (jl_value_t*)l;
l = l->next;
}
item = next;
pitem = pnext;
item_parent = next_parent;
}
}
JL_SIGATOMIC_END();
return;
}
开发者ID:antonblanchard,项目名称:julia,代码行数:63,代码来源:typemap.c
示例20: jl_sigatomic_end
DLLEXPORT void jl_sigatomic_end(void)
{
if (jl_defer_signal == 0)
jl_error("sigatomic_end called in non-sigatomic region");
JL_SIGATOMIC_END();
}
开发者ID:dhiltonp,项目名称:julia,代码行数:6,代码来源:jlapi.c
注:本文中的JL_SIGATOMIC_END函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论