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


C++ rb_gc_mark函数代码示例

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


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

示例1: Game_mark

static void
Game_mark(Game* game)
{
  if (game && !NIL_P(game->screen)) {
    rb_gc_mark(game->screen);
  }
}
开发者ID:CaptainJet,项目名称:RM-StarRuby,代码行数:7,代码来源:game.c

示例2: vm_mark_each_thread_func

static int
vm_mark_each_thread_func(st_data_t key, st_data_t value, st_data_t dummy)
{
    VALUE thval = (VALUE)key;
    rb_gc_mark(thval);
    return ST_CONTINUE;
}
开发者ID:qnighy,项目名称:ruby-1.9.2p0,代码行数:7,代码来源:vm.c

示例3: frame_mark_i

static int
frame_mark_i(st_data_t key, st_data_t val, st_data_t arg)
{
    VALUE frame = (VALUE)key;
    rb_gc_mark(frame);
    return ST_CONTINUE;
}
开发者ID:agrimm,项目名称:stackprof,代码行数:7,代码来源:stackprof.c

示例4: context_mark

static void
context_mark(void *data)
{
  debug_context_t *context = (debug_context_t *) data;

  rb_gc_mark(context->backtrace);
}
开发者ID:guilherme,项目名称:byebug,代码行数:7,代码来源:context.c

示例5: oci8_lob_mark

static void oci8_lob_mark(oci8_base_t *base)
{
    oci8_lob_t *lob = (oci8_lob_t *)base;
    if (lob->svcctx != NULL) {
        rb_gc_mark(lob->svcctx->base.self);
    }
}
开发者ID:Captnwalker1,项目名称:ruby-oci8,代码行数:7,代码来源:lob.c

示例6: mark

static void mark(xmlNodePtr node)
{
  /* it's OK if the document isn't fully realized (as in XML::Reader). */
  /* see http://github.com/tenderlove/nokogiri/issues/closed/#issue/95 */
  if (DOC_RUBY_OBJECT_TEST(node->doc) && DOC_RUBY_OBJECT(node->doc))
    rb_gc_mark(DOC_RUBY_OBJECT(node->doc));
}
开发者ID:AdamDotCom,项目名称:my-rvm,代码行数:7,代码来源:xml_node.c

示例7: rb_grn_database_mark_existing_ruby_object

static void
rb_grn_database_mark_existing_ruby_object (grn_ctx *context, grn_obj *database)
{
    grn_table_cursor *cursor;
    grn_id id;

    cursor = grn_table_cursor_open(context, database, NULL, 0, NULL, 0,
				   0, -1, GRN_CURSOR_ASCENDING);
    if (!cursor)
	return;

    while ((id = grn_table_cursor_next(context, cursor)) != GRN_ID_NIL) {
	grn_obj *object;
	grn_user_data *user_data;
	RbGrnObject *rb_grn_object;

	object = grn_ctx_at(context, id);
	if (!object)
	    continue;
	user_data = grn_obj_user_data(context, object);
	if (!user_data)
	    continue;
	rb_grn_object = RB_GRN_OBJECT(user_data->ptr);
	if (!rb_grn_object)
	    continue;
	rb_gc_mark(rb_grn_object->self);
    }
    grn_table_cursor_close(context, cursor);
}
开发者ID:ryoqun,项目名称:rroonga,代码行数:29,代码来源:rb-grn-database.c

示例8: cont_mark

static void
cont_mark(void *ptr)
{
    RUBY_MARK_ENTER("cont");
    if (ptr) {
	rb_context_t *cont = ptr;
	rb_gc_mark(cont->value);
	rb_thread_mark(&cont->saved_thread);

	if (cont->vm_stack) {
#ifdef CAPTURE_JUST_VALID_VM_STACK
	    rb_gc_mark_locations(cont->vm_stack,
				 cont->vm_stack + cont->vm_stack_slen + cont->vm_stack_clen);
#else
	    rb_gc_mark_localtion(cont->vm_stack,
				 cont->vm_stack, cont->saved_thread.stack_size);
#endif
	}

	if (cont->machine_stack) {
	    rb_gc_mark_locations(cont->machine_stack,
				 cont->machine_stack + cont->machine_stack_size);
	}
#ifdef __ia64
	if (cont->machine_register_stack) {
	    rb_gc_mark_locations(cont->machine_register_stack,
				 cont->machine_register_stack + cont->machine_register_stack_size);
	}
#endif
    }
    RUBY_MARK_LEAVE("cont");
}
开发者ID:3runo5ouza,项目名称:rhodes,代码行数:32,代码来源:cont.c

示例9: helium_rb_callback

void helium_rb_callback(const helium_connection_t *conn, uint64_t sender_mac, char * const message, size_t n)
{
  struct helium_queued_callback queued = {
    .sender_mac = sender_mac,
    .message = malloc(n),
    .count = n,
    .conn = (helium_connection_t *)conn,
    .mutex = PTHREAD_MUTEX_INITIALIZER,
    .cond = PTHREAD_COND_INITIALIZER,
    .next = NULL
  };

  memcpy(queued.message, message, n);

  add_queued_callback(&queued);

  pthread_cond_signal(&g_callback_cond);

  pthread_mutex_lock(&queued.mutex);
  pthread_cond_wait(&queued.cond, &queued.mutex);
  pthread_mutex_unlock(&queued.mutex);
}

void helium_rb_mark(void * p) {
  helium_connection_t *conn = (helium_connection_t*)p;
  // make sure we mark the callback proc too so it doesn't get GCed
  rb_gc_mark(helium_get_context(conn));
}
开发者ID:helium,项目名称:rbhelium,代码行数:28,代码来源:helium_ext.c

示例10: rb_vm_mark

void
rb_vm_mark(void *ptr)
{
    int i;

    RUBY_MARK_ENTER("vm");
    RUBY_GC_INFO("-------------------------------------------------\n");
    if (ptr) {
	rb_vm_t *vm = ptr;
	if (vm->living_threads) {
	    st_foreach(vm->living_threads, vm_mark_each_thread_func, 0);
	}
	RUBY_MARK_UNLESS_NULL(vm->thgroup_default);
	RUBY_MARK_UNLESS_NULL(vm->mark_object_ary);
	RUBY_MARK_UNLESS_NULL(vm->load_path);
	RUBY_MARK_UNLESS_NULL(vm->loaded_features);
	RUBY_MARK_UNLESS_NULL(vm->top_self);
	RUBY_MARK_UNLESS_NULL(vm->coverages);
	rb_gc_mark_locations(vm->special_exceptions, vm->special_exceptions + ruby_special_error_count);

	if (vm->loading_table) {
	    rb_mark_tbl(vm->loading_table);
	}

	mark_event_hooks(vm->event_hooks);

	for (i = 0; i < RUBY_NSIG; i++) {
	    if (vm->trap_list[i].cmd)
		rb_gc_mark(vm->trap_list[i].cmd);
	}
    }

    RUBY_MARK_LEAVE("vm");
}
开发者ID:qnighy,项目名称:ruby-1.9.2p0,代码行数:34,代码来源:vm.c

示例11: cont_mark

static void
cont_mark(void *ptr)
{
    RUBY_MARK_ENTER("cont");
    if (ptr) {
	rb_context_t *cont = ptr;
	rb_gc_mark(cont->value);

	rb_thread_mark(&cont->saved_thread);
	rb_gc_mark(cont->saved_thread.self);

	if (cont->vm_stack) {
#ifdef CAPTURE_JUST_VALID_VM_STACK
	    rb_gc_mark_locations(cont->vm_stack,
				 cont->vm_stack + cont->vm_stack_slen + cont->vm_stack_clen);
#else
	    rb_gc_mark_locations(cont->vm_stack,
				 cont->vm_stack, cont->saved_thread.stack_size);
#endif
	}

	if (cont->machine.stack) {
	    if (cont->type == CONTINUATION_CONTEXT) {
		/* cont */
		rb_gc_mark_locations(cont->machine.stack,
				     cont->machine.stack + cont->machine.stack_size);
            }
            else {
		/* fiber */
		rb_thread_t *th;
                rb_fiber_t *fib = (rb_fiber_t*)cont;
		GetThreadPtr(cont->saved_thread.self, th);
		if ((th->fiber != fib) && fib->status == RUNNING) {
		    rb_gc_mark_locations(cont->machine.stack,
					 cont->machine.stack + cont->machine.stack_size);
		}
	    }
	}
#ifdef __ia64
	if (cont->machine.register_stack) {
	    rb_gc_mark_locations(cont->machine.register_stack,
				 cont->machine.register_stack + cont->machine.register_stack_size);
	}
#endif
    }
    RUBY_MARK_LEAVE("cont");
}
开发者ID:rhenium,项目名称:ruby,代码行数:47,代码来源:cont.c

示例12: mark

static void
mark(struct png_data *reader)
{
    VALUE io = reader->io;

    if (io)
	rb_gc_mark(io);
}
开发者ID:ender672,项目名称:axon,代码行数:8,代码来源:png.c

示例13: cb_http_request_mark

void
cb_http_request_mark(void *ptr)
{
    struct cb_http_request_st *request = ptr;
    if (request) {
        rb_gc_mark(request->on_body_callback);
    }
}
开发者ID:funny-falcon,项目名称:couchbase-ruby-client,代码行数:8,代码来源:http.c

示例14: mark_root_object

/*
 * Mark root object. (protect from GC)
 */
void
mark_root_object(void *ptr)
{
  VALUE value;
  if (ptr && st_lookup(root_table, (st_data_t)ptr, (st_data_t*)&value)) {
    rb_gc_mark(value);
  }
}
开发者ID:JobV,项目名称:ruby-opencv,代码行数:11,代码来源:opencv.cpp

示例15: cb_timer_mark

    void
cb_timer_mark(void *ptr)
{
    struct timer_st *timer = ptr;
    if (timer) {
        rb_gc_mark(timer->callback);
    }
}
开发者ID:wr0ngway,项目名称:couchbase-ruby-client,代码行数:8,代码来源:timer.c


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