summaryrefslogtreecommitdiff
path: root/thread.c
AgeCommit message (Collapse)Author
2017-03-14Fiber also has same issue. [Bug #13313]ko1
* thread.c (rb_vm_proc_local_ep): added. * cont.c (rb_fiber_start): use rb_vm_proc_local_ep(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57970 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-14thread.c: Thread.start with Symbolnobu
* thread.c (thread_do_start): fix segfault at start with Symbol. proc created by Symbol#to_proc does not have environment unless using refinements. [ruby-core:80147] [Bug #13313] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57969 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-14thread.c: thread_do_startnobu
* thread.c (thread_do_start): extract from a macro in thread_start_func_2 for debugger. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57968 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-13thread.c: rb_thread_fd_close [ci skip]nobu
* thread.c (rb_thread_fd_close): remove deprecated. a couple of external libraries used it. [ruby-core:80078] [Bug #13304] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57950 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-13thread.c: rb_thread_fd_close no longer returnsnobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57949 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-13thread.c: rb_thread_fd_close [ci skip]nobu
* thread.c (rb_thread_fd_close): re-define only for abi-check, abort if called. [ruby-core:80078] [Bug #13304] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57948 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-02-22Thread#fetchnobu
* thread.c (rb_thread_fetch): add new method Thread#fetch. [Feature #13009] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57683 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-02-15thread.c: fix for VCnobu
* thread.c (rb_fd_no_init): make void same as rb_fd_init_copy. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57633 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-02-14initialize variablesnobu
* string.c (rb_str_enumerate_lines): initialize conditionally used variable. * thread.c (rb_fd_no_init): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57625 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-02-13thread.c: use ASSUME only on gcc 5 or laternobu
* thread.c (rb_fd_no_init): on gcc 4, ASSUME macro affects something too much. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57622 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-02-13suppress warningsnobu
* string.c (rb_str_enumerate_lines): hint to suppress a maybe-uninitialized warning by gcc. * thread.c (rb_fd_no_init): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57618 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-02-10check thread deadness correctly.ko1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57595 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-01-31define rb_thread_sleep_deadly_allow_spurious_wakeup().ko1
* thread.c, thread_sync.c: define new function rb_thread_sleep_deadly_allow_spurious_wakeup() and use it instead of using sleep_forever() directly. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57478 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-01-31use TRUE/FALSE.ko1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57477 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-01-25io.c: close before waitnobu
* io.c (io_close_fptr): notify then close, and wait for other threads before free fptr. [ruby-core:79262] [Bug #13158] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57422 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-01-10thread.c: fix todonobu
* thread.c (rb_threadptr_pending_interrupt_check_mask): traverse the super class chain instead of making ancestors array. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57294 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-27thread.c: fix race between read and closenobu
* thread.c (rb_thread_fd_close): wait until all threads using the fd finish the operation, not to free the buffer in use. [ruby-core:78845] [Bug #13076] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57202 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-20proc.c: assume rb_iseq_location_t::first_lineno is always a Fixnumrhe
Do not check for the value of rb_iseq_constant_body::line_info_table as it is no longer related. The checks seem to be the remains from the day before the dedicated 'first_lineno' field was introduced. Remove them. Note, rb_iseq_constant_body::line_info_table can be NULL only when the iseq does not contain any instructions that originate from Ruby code, for example, an iseq created with 'proc {}' under a non-default compile options where trace instructions are disabled. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57118 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-07Add clang volatile fixes from FreeBSD and NetBSD.shugo
Use volatile instead of optnone to avoid optimization which causes segmentation faults. Patch by Dimitry Andric. [ruby-core:78531] [Bug #13014] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57020 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-29thread.c: fix doc of abort_on_exception [ci skip]nobu
* thread.c (rb_thread_s_abort_exc, rb_thread_s_abort_exc_set): [DOC] the raised exception will be re-raised in the main thread, and then follows the ordinary exception sequence, exit status is not 0. [ruby-core:78415] [Bug #12991] * thread.c (rb_thread_abort_exc_set): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56928 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-05* vm_trace.c (tracepoint_attr_callee_id, rb_tracearg_callee_id):ktsj
add TracePoint#callee_id. [ruby-core:77241] [Feature #12747] * cont.c, eval.c, gc.c, include/ruby/intern.h, insns.def, thread.c, vm.c, vm_backtrace.c, vm_core.h, vm_eval.c, vm_insnhelper.c, vm_trace.c: ditto. * test/ruby/test_settracefunc.rb: tests for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56593 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-06thread.c: check coverage valuesnobu
* thread.c (update_coverage): check coverage values, and ignore non-fixnum values. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56354 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-16 * internal.h (WARN_UNUSED_RESULT): moved to configure.in, toshyouhei
actually check its availability rather to check GCC's version. * configure.in (WARN_UNUSED_RESULT): moved to here. * configure.in (RUBY_FUNC_ATTRIBUTE): change function declaration to return int rather than void, because it makes no sense for a warn_unused_result attributed function to return void. Funny thing however is that it also makes no sense for noreturn attributed function to return int. So there is a fundamental conflict between them. While I tested this, I confirmed both GCC 6 and Clang 3.8 prefers int over void to correctly detect necessary attributes under this setup. Maybe subject to change in future. * internal.h (UNINITIALIZED_VAR): renamed to MAYBE_UNUSED, then moved to configure.in for the same reason we move WARN_UNUSED_RESULT. * configure.in (MAYBE_UNUSED): moved to here. * internal.h (__has_attribute): deleted, because it has no use now. * string.c (rb_str_enumerate_lines): refactor macro rename. * string.c (rb_str_enumerate_bytes): ditto. * string.c (rb_str_enumerate_chars): ditto. * string.c (rb_str_enumerate_codepoints): ditto. * thread.c (do_select): ditto. * vm_backtrace.c (rb_debug_inspector_open): ditto. * vsnprintf.c (BSD_vfprintf): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56169 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-09thread.c: set cause by Thread#raisenobu
* thread.c (rb_threadptr_raise): set cause from the called thread, but not from the thread to be interrupted. [ruby-core:77222] [Bug #12741] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56125 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-28* vm_core.h: revisit the structure of frame, block and env.ko1
[Bug #12628] This patch introduce many changes. * Introduce concept of "Block Handler (BH)" to represent passed blocks. * move rb_control_frame_t::flag to ep[0] (as a special local variable). This flags represents not only frame type, but also env flags such as escaped. * rename `rb_block_t` to `struct rb_block`. * Make Proc, Binding and RubyVM::Env objects wb-protected. Check [Bug #12628] for more details. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55766 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-09* thread.c: Fixed implicit conversion error with Apple clang-800.0.31hsbt
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55619 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-08* thread.c (rb_wait_for_single_fd): Clean up fds.revents every timengoto
before calling ppoll(2). [Bug #12575] [ruby-dev:49725] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55613 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-15thread.c: fix thread_id formattingnobu
* thread.c (debug_deadlock_check): fix format specifier for thread_id, which may not be a pointer, nor even a scalar value. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55419 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-13* thread.c (debug_deadlock_check): show thread lock dependency andnaruse
backtrace [Feature #8214] [ruby-dev:47217] * thread.c (thread_status_name): show "sleep_forever" instead of "sleep" if called from inspect. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55397 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-06Thread.report_on_exceptionnobu
* thread.c (thread_start_func_2): report raised exception if report_on_exception flag is set. [Feature #6647] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55290 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-18* thread.c (recursive_list_access): a object id may be a Bignum. so,usa
the list must be a objhash, instead of a identhash. this fixes many test errors on mswin64 CI. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55063 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-09thread.c: GET_THREAD once in rb_thread_atforknobu
* thread.c (rb_thread_atfork_internal): move th to an argument. * thread.c (rb_thread_atfork): do not repeat GET_THREAD(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54961 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-09thread.c: clear atfork functionsnobu
* thread.c (rb_thread_atfork, rb_thread_atfork_before_exec): do nothing unless working fork is available. * thread_sync.c (rb_mutex_abandon_all): define only if working fork is available. * thread_sync.c (rb_mutex_abandon_keeping_mutexes): ditto. * thread_sync.c (rb_mutex_abandon_locking_mutex): ditto. * thread_win32.c (gvl_init): never used. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54960 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-08* configure.in: add -Wsuggest-attribute=noreturn and suppress warnings.naruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54943 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-05use TH_JUMP_TAGnobu
* vm_eval.c (rb_eval_cmd, rb_catch_obj): use TH_JUMP_TAG with the same rb_thread_t used for TH_PUSH_TAG, instead of JUMP_TAG with the current thread global variable. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54914 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-15thread.c: defer setting name in initializenobu
* thread.c (rb_thread_setname): defer setting native thread name set in initialize until the native thread is created. [ruby-core:74963] [Bug #12290] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54600 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-15thread.c: must be initialized to set namenobu
* thread.c (get_initialized_threadptr): extract ensuring that the thread is initialized. * thread.c (rb_thread_setname): thread must be initialized to set the name. [ruby-core:74963] [Bug #12290] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54598 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-06* ext/coverage/coverage.c: Fully reset coverage to not persist global state.eregon
It was returning old file coverages as empty arrays to the user. [ruby-core:74596] [Bug #12220] * ext/coverage/coverage.c (rb_coverages): remove unused static state. * thread.c: Moved and renamed coverage_clear_result_i to reset_coverage_i. * test/coverage/test_coverage.rb: improve precision of tests. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54504 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-31* thread.c (update_coverage): Do not track coverage in loaded fileseregon
after Coverage.result. Avoids out-of-bounds access. [Bug #12237] * ext/coverage/coverage.c (coverage_clear_result_i): document. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54465 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-10thread.c: check type of coveragenobu
* thread.c (update_coverage): check type of coverage array not only if non-zero. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54075 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-07thread.c: interrupt queue on uninitialized threadnobu
* thread.c (rb_thread_pending_interrupt_p): no pending interrupt before initialization. * thread.c (thread_raise_m, rb_thread_kill): uninitialized thread cannot interrupt. [ruby-core:72732] [Bug #11959] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53449 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-09* *.c (*_memsize): do not check ptr.ko1
NULL checking is finished Before call of memsize functions. See r52979. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52986 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-04thread.c: name must be ascii-compatiblenobu
* thread.c (rb_thread_setname): name must be ascii-compatible, as pthread APIs do not accept legacy wide char strings. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52876 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-03configure.in: split SET_THREAD_NAMEnobu
* configure.in: separate SET_CURRENT_THREAD_NAME, which can set the name of current thread only, and SET_ANOTHER_THREAD_NAME, which can set the name of other threads. * thread.c (rb_thread_setname): use SET_ANOTHER_THREAD_NAME. OS X is not possible to set another thread name. * thread_pthread.c (native_set_thread_name, thread_timer): use SET_CURRENT_THREAD_NAME. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52866 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-02thread.c: rb_thread_setname on OS Xnobu
* thread.c (rb_thread_setname): pthread_setname_np() on OS X takes the name only and sets the current thread. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52864 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-02* iseq.h: introduce ISEQ_COVERAGE() and ISEQ_COVERAGE_SET() macro.ko1
* compile.c: use them. * iseq.c: ditto. * iseq.c (rb_iseq_coverage): added. * thread.c (update_coverage): use rb_iseq_coverage(). * vm_core.h: rename coverage field name to support this fix. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52860 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-01thread.c: reset namenobu
* thread.c (rb_thread_setname): allow to reset thread name. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52835 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-01thread.c: check name argumentnobu
* thread.c (rb_thread_setname): check the argument if valid string. [ruby-core:71774] [Bug #11756] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52834 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-30* thread_pthread.c (register_ubf_list): renamed fromkosaki
add_signal_thread_list. * thread_pthread.c (unregister_ubf_list): renamed from remove_signal_thread_list. * thread_pthread.c (ubf_wakeup_all_threads): renamed from ping_signal_thread_list. * thread_pthread.c (ubf_wakeup_thread): renamed from ubf_select_each. * thread_pthread.c (ubf_threads_empty): renamed from check_signal_thread_list(). * thread_pthread.c (ubf_list_lock): renamed from signal_thread_list_lock. * thread_pthread.c (register_ubf_list): large simplification by using ccan/list.h. bonus: removed malloc() and exit(EXIT_FAILURE). * thread_pthread.c (unregister_ubf_list): ditto. * thread_pthread.c (ubf_threads_empty): ditto. * thread_pthread.c (ubf_wakeup_all_threads): ditto. * thread_pthread.c (print_signal_list): removed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52818 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-07thread.c (rb_cThreadShield): make staticnormal
Nothing outside of thread.c accesses this variable, so avoid cluttering up the global namespace with it. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52478 b2dd03c8-39d4-4d8f-98ff-823fe69b080e