restore rb_thread_t::local_storage.
* cont.c (rb_obj_is_fiber): add a new function to tell finalizer to
prevent fibers from destroy.
* gc.c (rb_objspace_call_finalizer): don't sweep fibers at finalizing
objspace.
* internal.h (rb_fiber_reset_root_local_storage, rb_obj_is_fiber):
add prototypes.
* vm.c (ruby_vm_destruct): reset main thread's local_storage before
free main thread. rb_thread_t::local_storage is replaced by fiber's
local storage when forked from fiber, and it should be already freed
when the fiber was destroyed.
* test/ruby/test_fiber.rb (test_fork_from_fiber): add test for fork
from fiber.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34629 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
but should return pointer suitable for ruby_xfree;
main vm and main thread.
patched by Sokolov Yura. https://github.com/ruby/ruby/pull/79
* internal.h: ditto.
* vm.c (Init_BareVM): use ruby_mimmalloc.
* ext/dl/cfunc.c: #include <ruby/util.h>.
* ext/syslog/syslog.c: use xfree because it is allocated by
ruby_strdup.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34257 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
in RBASIC()->flags. [ruby-dev:45002] [Bug #5768]
* thread.c (rb_barrier_wait): increment and decrement around
rb_mutex_lock, and use rb_barrier_waiting().
* thread.c (rb_barrier_release): use rb_barrier_waiting().
* thread.c (rb_barrier_destroy): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34163 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
share same loading barrier, so it must be kept alive while those
are waiting on it. [ruby-core:41618] [Bug #5754]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34027 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
the encoding of the format. On Windows (at least Japanese Windows),
Time#strftime("%Z") includes non ASCII in locale encoding (CP932).
So convert locale to default internal. [ruby-core:39092] [Bug #5226]
* strftime.c (rb_strftime): ditto.
* strftime.c (rb_strftime_timespec): ditto.
* internal.h (rb_strftime_timespec): follow above.
* time.c (rb_strftime_alloc): ditto.
* time.c (strftimev): ditto.
* time.c (time_strftime): ditto.
* time.c (time_to_s): the resulted string of Time#to_s is always
ascii only, so this should be US-ASCII.
* time.c (time_asctime): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33094 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_eval.c (method_missing): set the length of argv array, to mark
arguments.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32740 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
avoid inadvertent symbol creation in reflection methods. based
on a patch by Jeremy Evans at [ruby-core:38367]. [Feature #5072]
* vm_method.c (rb_mod_method_defined)
(rb_mod_{public,private,protected}_method_defined)
(obj_respond_to): ditto.
* parse.y (rb_check_id): new function returns already interned ID
or 0.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32621 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
make them visible as experimental C APIs. fixes Feature #4328.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32486 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Fix rdoc.
* ext/objspace/objspace.c (ObjectSpace.count_tdata_objects):
Change key type if the klass of a object is zero (internal object).
Read rdoc for details.
* internal.h: export rb_objspace_data_type_name().
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32323 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
In timer thread, signal handler shoul use it.
The patch is contributed by Eric Wong <normalperson@yhbt.net>.
Refs: [ruby-core:37644] and [ruby-core:37647]
* thread_pthread.c: use rb_async_bug_errno().
And replace all fprintf() to write().
* internal.h (rb_async_bug_errno): add decl. of above func.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32274 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
from intern.h to internal.h. It's still experimental API and
need more discussion. [ruby-dev:43698]
* include/ruby/intern.h: ditto.
* ext/socket/rubysocket.h: include internal.h.
* ext/socket/depend: add internal.h dependency.
* ext/socket/extconf.rb: add $INCFLAGS to topdir.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32187 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
from intern.h to internal.h. It's still experimental API and
need more discussion.
* include/ruby/intern.h: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32183 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* compile.c, eval.c, iseq.c, object.c, parse.y, proc.c, process.c,
thread.c, vm.c, vm_eval.c, vm_insnhelper.c, vm_method.c: don't
declare internal functions.
Note that rb_method_entry_eq() is defined in vm_method.c but
there was a declaration in proc.c with different const-ness.
Now it is declared in method.h with same const-ness to the
definition.
* object.c (rb_mod_module_exec): don't declare functions declared in
include/ruby/intern.h.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32163 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
based on the patch by Eric Wong. [ruby-core:36156]
* vm_core.h (rb_thread_call_with_gvl): don't declare here.
* thread.c: include internal.h.
(rb_thread_execute_interrupts): new function.
* internal.h (rb_thread_execute_interrupts): declared.
(rb_thread_call_with_gvl): declared.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31971 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
type check to get rid of a double free when main Thread has singleton
class. [ruby-core:36741] [Bug #4828]
* thread.c (rb_obj_is_mutex): add a new utility function.
* vm.c (rb_obj_is_thread): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31968 b2dd03c8-39d4-4d8f-98ff-823fe69b080e