[前][次][番号順一覧][スレッド一覧]

ruby-changes:47060

From: ko1 <ko1@a...>
Date: Mon, 26 Jun 2017 14:36:14 +0900 (JST)
Subject: [ruby-changes:47060] ko1:r59175 (trunk): add "FIBER_" prefix.

ko1	2017-06-26 14:36:10 +0900 (Mon, 26 Jun 2017)

  New Revision: 59175

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=59175

  Log:
    add "FIBER_" prefix.
    
    * cont.c (enum fiber_status): add "FIBER_" prefix for all names.

  Modified files:
    trunk/cont.c
Index: cont.c
===================================================================
--- cont.c	(revision 59174)
+++ cont.c	(revision 59175)
@@ -107,9 +107,9 @@ typedef struct rb_context_struct { https://github.com/ruby/ruby/blob/trunk/cont.c#L107
 } rb_context_t;
 
 enum fiber_status {
-    CREATED,
-    RUNNING,
-    TERMINATED
+    FIBER_CREATED,
+    FIBER_RUNNING,
+    FIBER_TERMINATED
 };
 
 #if FIBER_USE_NATIVE && !defined(_WIN32)
@@ -199,7 +199,7 @@ cont_mark(void *ptr) https://github.com/ruby/ruby/blob/trunk/cont.c#L199
 	    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) {
+	    if ((th->fiber != fib) && fib->status == FIBER_RUNNING) {
 		rb_gc_mark_locations(cont->machine.stack,
 				     cont->machine.stack + cont->machine.stack_size);
 	    }
@@ -687,7 +687,7 @@ fiber_setcontext(rb_fiber_t *newfib, rb_ https://github.com/ruby/ruby/blob/trunk/cont.c#L687
 {
     rb_thread_t *th = GET_THREAD(), *sth = &newfib->cont.saved_thread;
 
-    if (newfib->status != RUNNING) {
+    if (newfib->status != FIBER_RUNNING) {
 	fiber_initialize_machine_stack_context(newfib, th->vm->default_params.fiber_machine_stack_size);
     }
 
@@ -699,7 +699,7 @@ fiber_setcontext(rb_fiber_t *newfib, rb_ https://github.com/ruby/ruby/blob/trunk/cont.c#L699
     }
 
     /* save  oldfib's machine stack */
-    if (oldfib->status != TERMINATED) {
+    if (oldfib->status != FIBER_TERMINATED) {
 	STACK_GROW_DIR_DETECTION;
 	SET_MACHINE_STACK_END(&th->machine.stack_end);
 	if (STACK_DIR_UPPER(0, 1)) {
@@ -1176,7 +1176,7 @@ fiber_t_alloc(VALUE fibval) https://github.com/ruby/ruby/blob/trunk/cont.c#L1176
     fib->cont.type = FIBER_CONTEXT;
     cont_init(&fib->cont, th);
     fib->prev = NULL;
-    fib->status = CREATED;
+    fib->status = FIBER_CREATED;
 
     DATA_PTR(fibval) = fib;
 
@@ -1272,7 +1272,7 @@ rb_fiber_start(void) https://github.com/ruby/ruby/blob/trunk/cont.c#L1272
 	th->errinfo = Qnil;
 	th->root_lep = rb_vm_proc_local_ep(cont->saved_thread.first_proc);
 	th->root_svar = Qfalse;
-	fib->status = RUNNING;
+	fib->status = FIBER_RUNNING;
 
 	EXEC_EVENT_HOOK(th, RUBY_EVENT_FIBER_SWITCH, th->self, 0, 0, 0, Qnil);
 	cont->value = rb_vm_invoke_proc(th, proc, argc, argv, VM_BLOCK_HANDLER_NONE);
@@ -1307,7 +1307,7 @@ root_fiber_alloc(rb_thread_t *th) https://github.com/ruby/ruby/blob/trunk/cont.c#L1307
     fib->fib_handle = ConvertThreadToFiber(0);
 #endif
 #endif
-    fib->status = RUNNING;
+    fib->status = FIBER_RUNNING;
 
     return fib;
 }
@@ -1431,10 +1431,10 @@ fiber_switch(rb_fiber_t *fib, int argc, https://github.com/ruby/ruby/blob/trunk/cont.c#L1431
     else if (cont->saved_thread.protect_tag != th->protect_tag) {
 	rb_raise(rb_eFiberError, "fiber called across stack rewinding barrier");
     }
-    else if (fib->status == TERMINATED) {
+    else if (fib->status == FIBER_TERMINATED) {
 	value = rb_exc_new2(rb_eFiberError, "dead fiber called");
 
-	if (th->fiber->status != TERMINATED) rb_exc_raise(value);
+	if (th->fiber->status != FIBER_TERMINATED) rb_exc_raise(value);
 
 	/* th->fiber is also dead => switch to root fiber */
 	/* (this means we're being called from rb_fiber_terminate, */
@@ -1481,7 +1481,7 @@ static void https://github.com/ruby/ruby/blob/trunk/cont.c#L1481
 rb_fiber_terminate(rb_fiber_t *fib)
 {
     VALUE value = fib->cont.value;
-    fib->status = TERMINATED;
+    fib->status = FIBER_TERMINATED;
 #if FIBER_USE_NATIVE && !defined(_WIN32)
     /* Ruby must not switch to other thread until storing terminated_machine_stack */
     terminated_machine_stack.ptr = fib->ss_sp;
@@ -1541,7 +1541,7 @@ rb_fiber_alive_p(VALUE fibval) https://github.com/ruby/ruby/blob/trunk/cont.c#L1541
 {
     rb_fiber_t *fib;
     GetFiberPtr(fibval, fib);
-    return fib->status != TERMINATED ? Qtrue : Qfalse;
+    return fib->status != FIBER_TERMINATED ? Qtrue : Qfalse;
 }
 
 /*

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]