aboutsummaryrefslogtreecommitdiffstats
path: root/thread.c
Commit message (Collapse)AuthorAgeFilesLines
* * compile.h, insns.def: reduce insn operand of "trace".ko12008-07-011-2/+2
| | | | | | | | * include/ruby/ruby.h: add RUBY_EVENT_COVERAGE event. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17785 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * Add coverage measurement constant COVERAGE__. This constant is notmame2008-07-011-0/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | for casual use. Usage: (1) assign {} to COVERAGE__, (2) require or load Ruby source file, and (3) COVERAGE__["sourcefilepath"] will return an array whose elements represent number of executions per line of source code. * vm_core.h: add field of coverage array to iseq. * iseq.c (prepare_iseq_build): ditto. * insns.def (trace): update coverage array. * parse.y (coverage): create and initialize coverage array. * compile.h (ADD_TRACE): add trace instruction to update covearge array. * thread.c (clear_coverage): delete coverage array when forking. Otherwise, double count of coverage may occur. * lib/coverage.rb: sample coverage measurement tool. * error.c: distinguish explicitly between parse_in_eval and mild_compile_error. * load.c: ditto. * vm_eval.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17781 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * iseq.c (COMPILE_OPTION_FALSE), time.c (timegm_noleapsecond),nobu2008-07-011-2/+2
| | | | | | | | thread.c (eKillSignal, eTerminateSignal), missing/vsnprintf.c (BSD_vfprintf): constified. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17769 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_memhash): randomize hash to avoid algorithmicakr2008-06-201-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | complexity attacks. (rb_str_hash): use rb_memhash. * include/ruby/intern.h (rb_reset_random_seed): declared. * thread.c (rb_thread_atfork): call rb_reset_random_seed. * inits.c (rb_call_inits): call Init_RandomSeed at first. * random.c (seed_initialized): defined. (fill_random_seed): extracted from random_seed. (make_seed_value): extracted from random_seed. (rb_f_rand): initialize random seed at first. (initial_seed): defined. (Init_RandomSeed): defined. (Init_RandomSeed2): defined. (rb_reset_random_seed): defined. (Init_Random): call Init_RandomSeed2. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17465 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * thread.c: try to remove false positive of deadlock detection (secondmame2008-06-191-2/+4
| | | | | | | trial). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17451 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * thread.c, thread_win32.c, vm_core.h: try to remove false positive ofmame2008-06-191-23/+76
| | | | | | | deadlock detection. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17435 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * thread.c (thread_start_func_2): use PRIxVALUE to format a VALUE.nobu2008-06-161-2/+2
| | | | | | | * thread.c (ruby_native_thread_p): removed unused declaration. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17367 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm_core.h, thread.c: rename global_interpreter_lock toko12008-06-151-7/+7
| | | | | | | | global_vm_lock. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17349 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * gc.h (STACK_UPPER): moved from gc.cnobu2008-06-141-0/+6
| | | | | | | | * thread.c, thread_{pthread,win32}.c (ruby_init_stack, ruby_thread_init_stack): moved stack initialization from gc.c. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * thread.c (mutex_unlock): fix cond_notified consistency.mame2008-06-121-0/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17113 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * thread.c, vm_core.h, vm.c, thread_pthread.c, thread_win32.c: addmame2008-06-121-34/+199
| | | | | | | | | deadlock detection. [ruby-dev:35044] * bootstraptest/test_thread.rb: add tests for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17110 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/intern.h, proc.c: revert rb_proc_call() andko12008-06-101-5/+10
| | | | | | | | | | create rb_proc_call_with_block() instaed. * include/ruby/ruby.h, eval_jump.c, thread.c, vm_insnhelper.c: rb_blockptr should not be exposed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17081 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/ruby.h, vm_core.h: add a type rb_blockptr.mame2008-06-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | * vm_insnhelper.c (vm_yield_with_cfunc): vm_yield_with_cfunc receives blockptr and passes it to iterating block. * proc.c (rb_proc_call), include/ruby/intern.h: rb_proc_call receives blockptr. "rb_proc_call(self, args, blockptr)" in C corresponds to "self.call(*args, &block)" in Ruby. * proc.c (proc_call): pass blockptr to block that is written in C. * proc.c (curry): receive blockptr and pass it to original proc. [ruby-core:15551] * vm.c (invoke_block_from_c): fix for change of vm_yield_with_cfunc. * thread.c (call_trace_proc), eval_jump.c (rb_call_end_proc): fix for change of rb_proc_call. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17065 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/ruby.h (CONST_ID): constant ID cache for non-gcc.nobu2008-06-091-0/+2
| | | | | | | * *.c: no cache in init functions. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17053 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c, bignum.c, cont.c, dir.c, dln.c, encoding.c, enumerator.c,ko12008-06-081-4/+3
| | | | | | | | | | | | | | | | | | | enumerator.c (enumerator_allocate), eval_jump.c, file.c, hash.c, io.c, load.c, pack.c, proc.c, random.c, re.c, ruby.c, st.c, string.c, thread.c, thread_pthread.c, time.c, util.c, variable.c, vm.c, gc.c: allocated memory objects by xmalloc (ruby_xmalloc) should be freed by xfree (ruby_xfree). * ext/curses/curses.c, ext/dbm/dbm.c, ext/digest/digest.c, ext/gdbm/gdbm.c, ext/json/ext/parser/parser.c, ext/json/ext/parser/unicode.c, ext/openssl/ossl_cipher.c, ext/openssl/ossl_hmac.c, ext/openssl/ossl_pkey_ec.c, ext/sdbm/init.c, ext/strscan/strscan.c, ext/zlib/zlib.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17017 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * eval.c (ruby_finalize_0): clear trace_func after executing ENDmame2008-06-051-3/+3
| | | | | | | | | procs. * thread.c: fix typo. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16846 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * thread.c (thread_set_trace_func_m): fix check for proc argument.mame2008-06-051-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16841 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * suppress warnings on cygwin, mingw and mswin.nobu2008-06-011-0/+3
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16740 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * suppress warnings with -Wwrite-string.nobu2008-05-311-3/+3
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16716 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm_core.h (struct rb_unblock_callback), thread.cnobu2008-05-301-13/+20
| | | | | | | | | | | (set_unblock_function), thread_{pthread,win32}.c (native_sleep): extracted from struct rb_thread_struct. * thread.c (reset_unblock_function): not check interrupts at leaving blocking region. [ruby-dev:34874] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16699 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * thread.c (rb_thread_execute_interrupts): delay interrupts duringnobu2008-05-271-0/+1
| | | | | | | raising exceptions. [ruby-dev:34855] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16651 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * thread.c (thread_cleanup_func_before_exec): extracted fromakr2008-05-111-1/+34
| | | | | | | | | | | | | | | | | | | | | thread_cleanup_func not to touch pthread data. pthread_cond_destroy in forked process may cause deadlock on Debian GNU/Linux Etch on x86, x86-64 and IA64. this doesn't cause resource leak because the process will exec soon. (terminate_atfork_before_exec_i): defined. (rb_thread_atfork_before_exec): defined. * include/ruby/intern.h (rb_thread_atfork_before_exec): declared. * process.c (rb_exec_atfork): call rb_thread_atfork_before_exec instead of rb_thread_atfork. * io.c (popen_exec): call rb_thread_atfork_before_exec instead of rb_thread_atfork. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16355 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * thread.c (timeofday): use monotonic clock. based on a patchmatz2008-05-091-3/+12
| | | | | | from zimbatm <zimbatm@oree.ch> in [ruby-core:16627]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16338 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * thread.c (rb_gc_save_machine_context): call FLUSH_REGISTER_WINDOWSakr2008-05-081-0/+1
| | | | | | | to mark the register stack from GC on another thread. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16328 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * thread.c (rb_thread_key_p): thread local storage stores ID.nobu2008-05-071-4/+4
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16318 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * thread.c (rb_thread_key_p): should always convert symbol to ID.matz2008-05-071-2/+4
| | | | | | [ruby-dev:34588] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16315 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c, signal.c, thread.c, thread_win32.c, include/ruby/intern.h:nobu2008-04-261-6/+8
| | | | | | | suppress warnings. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16204 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * thread.c (rb_thread_stop_timer_thread): should clearmatz2008-04-221-0/+1
| | | | | | timer_thread_id after stopping it. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16136 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * thread.c (thread_join): remove the current thread from the join listnobu2008-04-221-9/+55
| | | | | | | of the target thread. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16135 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * thread_pthread.c (lock_func): should not check interrupts innobu2008-04-131-9/+13
| | | | | | | blocking region. [ruby-dev:34378] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15990 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * thread.c (lock_func): optimized and checks for interrupt_flag.nobu2008-04-091-21/+10
| | | | | | | | based on a patch from Sylvain Joyeux in [ruby-Patches-19361] and [ruby-Patches-19362]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15931 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * thread.c (rb_mutex_sleep): ensures to re-acquire at waking up.nobu2008-04-081-4/+18
| | | | | | | [ruby-Patches-19361] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15928 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c: IO.copy_stream implemented. [ruby-dev:33843]akr2008-03-301-0/+19
| | | | | | | | | | | * thread.c (rb_fd_select): new function. * configure.in (sys/sendfile.h): check the header file. (sendfile): check the function. (pread): check the function. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15858 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * eval_method.c (rb_get_method_body): ent->method may be freed bymatz2008-03-011-3/+6
| | | | | | | | | GC. [ruby-dev:31819] * thread.c (remove_event_hook): should not access freed memory. [ruby-dev:31820] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15654 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * eval.c (stack_check): made flag per threads.nobu2008-02-281-8/+8
| | | | | | | * thread.c (rb_thread_set_raised, rb_thread_reset_raised): prefixed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15625 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * thread.c (thread_create_core): prohibit thread creation in thematz2008-01-181-1/+5
| | | | | | | | | | frozen thread group. a patch in [ruby-dev:33176] from sheepman <sheepman AT sheepman.sakura.ne.jp>. * thread.c (thread_create_core): should inherit ThreadGroup from the current thread. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15118 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * thread.c (thread_create_core): set thread group before creatingnobu2008-01-181-1/+1
| | | | | | | thread. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15115 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * thread.c (thread_cleanup_func): ignore errors from destroying mutexnobu2008-01-181-1/+0
| | | | | | | | | of dead thread. [ruby-core:15069] * thread_pthread.c, thread_win32.c (native_thread_destroy): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15111 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * thread.c: clear thread structure.ko12008-01-141-1/+13
| | | | | | | | | (TODO: survey that child process should clear mutex or not). * bootstraptest/test_knownbug.rb, test_thread.rb: move a fixed test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15044 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * thread.c (rb_mutex_unlock): proper error message for unlockingmatz2008-01-101-10/+18
| | | | | | | mutex that is not locked. a patch from Yusuke ENDOH <mame at tsg.ne.jp> in [ruby-dev:33010]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14980 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * $Date$ keyword removed to avoid inclusion of locale dependentakr2008-01-061-1/+0
| | | | | | | string. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14912 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * thread.c: remove Thread.critical(=).ko12007-12-251-15/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14701 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/ruby.h, thread.c: rename is_ruby_native_thread() toko12007-12-251-1/+1
| | | | | | | | | ruby_native_thread_p(). * ext/tk/tcltklib.c: apply it. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14680 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * thread.c (rb_thread_wait_fd_rw): should check EBADF on select().ko12007-12-251-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14658 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * README.EXT.ja, dir.c, eval.c, eval_intern.h, lex.c.src,matz2007-12-251-1/+1
| | | | | | | | lex.c.blt, keywords, load.c, thread.c: more ANSI'ize. a patch from Tadashi Saito <shiba AT mail2.accsnet.ne.jp> in [ruby-dev:32725] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14655 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm_core.h, thread.c, cont.c: add RUBY_VM_SET_INTERRUPT(),ko12007-12-251-3/+3
| | | | | | | | | | | RUBY_VM_SET_TIMER_INTERRUPT(), RUBY_VM_INTERRUPTED(). * thread.c, thread_pthread.c, thread_win32.c: fix to ignore time slice event until sleep. * bootstraptest/test_thread.rb: add a test for time limited join test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14654 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * load.c (load_lock): reverted.nobu2007-12-241-0/+3
| | | | | | | * thread.c (rb_barrier_wait): check for recursive wait. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14593 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* enable several rdoc.akr2007-12-241-12/+12
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14584 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * thread.c (rb_thread_atfork): should not leave living_threadsnobu2007-12-241-3/+2
| | | | | | | referring freed table while allocating new table. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14574 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * thread.c (rb_thread_atfork): fix to mark thread object.ko12007-12-211-1/+2
| | | | | | | | | [ruby-dev:32404] * bootstraptest/test_knownbug.rb, test_fork.rb: move a fixed test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14420 b2dd03c8-39d4-4d8f-98ff-823fe69b080e