summaryrefslogtreecommitdiffstats
path: root/thread.c
Commit message (Collapse)AuthorAgeFilesLines
* * cont.c (rb_fiber_current), dln.c (dln_print_undef, dln_undefined),nobu2009-02-011-3/+3
| | | | | | | | | | | eval.c (rb_iterator_p, rb_need_block), load.c: (Init_load), ruby.c (uscore_get, rb_f_chop), st.c (stat_col), signal.c (rb_signal_buff_size, ruby_sig_finalize), thread.c (rb_thread_sleep_forever, rb_thread_sleep_deadly, rb_thread_alone): protoized. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@21929 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * thread.c (rb_time_timeval): made a real prototype. a patch fromnobu2009-01-221-1/+1
| | | | | | | Marcus Rueckert <darix AT opensu.se> at [ruby-core:21492]. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@21725 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * thread.c (rb_thread_execute_interrupts): needsnobu2009-01-191-0/+1
| | | | | | | rb_signal_buff_size to be declared. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@21662 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm.c: add a prefix "rb_" to exposed functionsko12009-01-191-3/+3
| | | | | | | | | | | | | | | | | vm_get_ruby_level_next_cfp(), rb_vm_make_env_object(), vm_stack_to_heap(), vm_make_proc(), vm_invoke_proc(), vm_get_sourceline(), vm_cref(), vm_localjump_error(), vm_make_jump_tag_but_local_jump(), vm_jump_tag_but_local_jump(). This changes may affect only core because most of renamed functions require a pointer of not-exposed struct such as rb_thread_t or NODE. In short, they are core functions. * cont.c, eval.c, eval_intern.h, load.c, proc.c, thread.c, vm_core.h, vm_dump.c, vm_eval.c, vm_exec.c, vm_insnhelper.c: ditto. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@21659 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * thread.c (thread_start_func_2): call ruby_cleanup() if thread isko12009-01-161-1/+1
| | | | | | | | main thread. [ruby-dev:37624] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@21592 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * thread.c (rb_thread_execute_interrupts): if signal is alreadymame2009-01-151-2/+7
| | | | | | | | | | buffered, main thread should wait until timer thread delivers it. * thread.c (timer_thread_function): should defer delivery of a signal if main thread does not yet trap a previous one. [ruby-dev:37676] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@21582 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * thread.c (call_trace_proc): as Matz said ([ruby-core:21183]),ko12009-01-151-2/+3
| | | | | | | | | | should skip rb_str_new2() if rb_sourcefile() returns NULL. rb_sourcefile() returns NULL if frame is toplevel of Fiber. [ruby-core:21161] [Bug #985] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@21578 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/intern.h, thread.c, win32/Makefile.sub (rb_fdset_t,usa2009-01-131-0/+46
| | | | | | | | | | | | | | | rb_fd_init, rb_fd_term, rb_fd_zero, rb_fd_set, rb_fd_clr, rb_fd_isset, rb_fd_select, rb_fd_ptr, rb_fd_max, HAVE_RB_FD_INIT): new type, functions, and macros for Windows. * win32/win32.c (extract_fd, rb_w32_select): use rb_fdset_t to expand fd_array if needed. [ruby-core:19946] * win32/win32.c (copy_fd): new funcion for rb_w32_select(). git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@21487 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * thread.c: fix comment (terminology: Global VM Lock).ko12009-01-121-6/+40
| | | | | | | | | | | | * thread.c (blocking_region_begin, blocking_region_end): save and clear th->blocking_region_buffer. * thread.c (rb_thread_call_with_gvl): check if it has GVL. * thread.c (ruby_thread_has_gvl_p): added. * vm_core.h: add decls. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@21438 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* rdoc update.kazu2009-01-051-1/+1
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@21338 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * thread.c (rb_thread_blocking_region): add a comment.ko12008-12-301-1/+72
| | | | | | | | | | | | * thread.c (rb_thread_call_without_gvl): added as a alias of rb_thread_blocking_region(). * thread.c (rb_thread_call_with_gvl): added. * vm_core.h (rb_thread_t#blocking_region_buffer): added for rb_thread_call_with_gvl(). git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@21185 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * thread.c (rb_mutex_trylock): return false if Mutex ownedko12008-12-291-4/+5
| | | | | | | | | | by current thread. [ruby-core:20943] * thread.c (rb_mutex_lock): check dead lock (recursive lock) here. * test/ruby/test_thread.rb: add a test. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@21148 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * thread.c (mutex_free, mutex_unlock): add qualifiers.mame2008-12-281-3/+3
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@21106 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * thread.c (mutex_free): GC thread (main thread) has failed to unlockmame2008-12-281-7/+7
| | | | | | | | | | | | a mutex that is locked by another thread, which makes the mutex dangling in keeping_mutexes and causes [BUG] or stuck finally. Now unlocking is performed as locking thread. * thread.c (mutex_unlock, rb_mutex_unlock, rb_mutex_unlock_all): mutex_unlock receives a thread. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@21105 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * process.c (after_exec): needs to reset before restart timernobu2008-12-271-0/+3
| | | | | | | | | | thread. * thread.c (thread_start_func_2): stops timer thread if forked in the new thread. [ruby-core:19385] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@21097 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * thread.c (rb_thread_atfork, rb_thread_atfork_before_exec): DRY.nobu2008-12-271-24/+21
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@21096 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * thread.c (thread_start_func_2): sets native thread key.nobu2008-12-241-0/+2
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@20976 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* rdoc update.akr2008-12-221-1/+1
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@20917 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * thread.c (sleep_timeval): cast tv_usec to long to shut upmatz2008-12-151-2/+2
| | | | | | warnings on OSX. [ruby-dev:37449] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@20766 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * thread.c (rb_mutex_unlock): shut up warning. a patch frommatz2008-12-101-1/+1
| | | | | | Kazuhiro NISHIYAMA in [ruby-dev:37345]. fix #846 git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@20615 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * compile.c (iseq_compile_each), gc.c (assign_heap_slot),nobu2008-12-091-11/+12
| | | | | | | | | | | | | (gc_mark_children), parse.y (vtable_alloc, vtable_free, vtable_add), proc.c (proc_to_s), thread.c (terminate_i, rb_thread_terminate_all), (thread_start_func_2, blocking_region_begin, blocking_region_end), (rb_thread_kill), thread_pthread.c (native_thread_create), (ubf_pthread_cond_signal), vm.c (check_env, thread_free), vm_dump.c (vm_env_dump_raw, vm_stack_dump_each, vm_thread_dump_state), (vm_call0): use void pointer for %p. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@20593 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* move the previous comment.akr2008-12-021-0/+28
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@20447 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * gc.c (ruby_stack_check): no check if using sigaltstack.nobu2008-11-271-0/+8
| | | | | | | | | | | | | | | | * signal.c (register_sigaltstack): minimum size is insufficient for method calls. * signal.c (sigsegv): handles stack overflow if possible. * thread.c (ruby_thread_stack_overflow): helper function to raise sysstack_error. * thread_pthread.c (ruby_stack_overflowed_p): checks for stack overflow. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@20372 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * process.c (rb_fork): stops the timer thread during fork.nobu2008-11-241-0/+1
| | | | | | | | | | [ruby-dev:37117] * thread.c (rb_thread_start_timer_thread): timer thread needs system_working to be set. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@20346 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * thread.c (rb_barrier_wait): gets rid of recursive deadlock.nobu2008-11-131-0/+3
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@20230 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * thread.c (rb_barrier_{new,wait,release,destroy}): use Mutex so thatnobu2008-11-121-134/+14
| | | | | | | circular requires fail with deadlock. [ruby-core:19821] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@20229 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * load.c (rb_require_safe): destroys barrier after successfullynobu2008-11-111-5/+31
| | | | | | | | | | | | loaded, to get rid of loading same library again. [ruby-core:19798] * thread.c (rb_barrier_wait): can not wait destroyed barrier. * thread.c (rb_barrier_destroy): destroys barrier so that no longer waited. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@20223 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * thread_pthread.c (thread_timer): checks working flags again.nobu2008-11-081-2/+2
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@20160 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * thread.c (rb_thread_stop_timer_thread): terminates timer threadnobu2008-11-061-4/+4
| | | | | | | immediately. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@20117 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/intern.h (rb_mutex_synchronize): fixed prototype.nobu2008-11-031-1/+1
| | | | | | | * thread.c (rb_mutex_synchronize): fixed function name. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@20102 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * thread.c (blocking_region_{begin,end}): declared as inline.nobu2008-10-261-3/+3
| | | | | | | | | * util.c (freedtoa): used only when MULTIPLE_THREADS is not defined. * win32/win32.c (rb_w32_pipe): serial is DWORD. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19945 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * thread.c (rb_thread_wait_fd_rw): should not block by select ifmatz2008-10-081-0/+1
| | | | | | there's only one thread living. fixed [ruby-dev:36646]. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19719 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * thread.c (thlist_signal): clears the woken thread if nothing woke.nobu2008-09-261-3/+6
| | | | | | | | * thread.c (rb_barrier_wait): achieves the lock if no thread was waiting yet. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19573 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/rubysig.h: old macros for backward compatibility.nobu2008-09-261-12/+57
| | | | | | | * thread.c (BLOCKING_REGION): rewritten using helper functions. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19562 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * thread.c (rb_thread_blocking_region): fix typo in a document.ko12008-09-231-1/+2
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19479 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * thread.c (rb_thread_blocking_region): write a documentko12008-09-231-0/+28
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19478 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * thread.c, include/ruby/intern.h (rb_thread_interrupted): added.ko12008-09-231-0/+9
| | | | | | | | * io.c: use VALUE of thead instead of rb_tread_t to check interrupts. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19477 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * common.mk: clean upko12008-09-231-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | - remove blockinlining.$(OBJEXT) to built - make ENCODING_H_INCLDUES variable (include/ruby/encoding.h) - make VM_CORE_H_INCLUDES variable (vm_core.h) - simplify rules. - make depends rule to output depend status using gcc -MM. * include/ruby/mvm.h, include/ruby/vm.h: rename mvm.h to vm.h. * include/ruby.h: ditto. * load.c: add inclusion explicitly. * enumerator.c, object.c, parse.y, thread.c, vm_dump.c: remove useless inclusion. * eval_intern.h: cleanup inclusion. * vm_core.h: rb_thread_t should be defined in this file. * vm_evalbody.c, vm_exec.c: rename vm_evalbody.c to vm_exec.c. * vm.h, vm_exec.h: rename vm.h to vm_exec.h. * insnhelper.h, vm_insnhelper.h: rename insnhelper.h to vm_insnhelper.h. * vm.c, vm_insnhelper.c, vm_insnhelper.h: - rename vm_eval() to vm_exec_core(). - rename vm_eval_body() to vm_exec(). - cleanup include order. * vm_method.c: fix comment. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19466 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * iseq.c (iseq_data_to_ary): make it static.ko12008-09-041-1/+1
| | | | | | | | * thread.c (thgroup_enclose): ditto. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19146 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * thread.c (rb_thread_critical): removed.ko12008-09-041-2/+0
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19144 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * thread.c (rb_thread_check_trap_pending): added for compatibility.ko12008-09-041-0/+10
| | | | | | | | | * ext/tk/tcltklib.c, ext/tk/tkutil/tkutil.c: remove ruby/signal.h dependency. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19128 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm_core.h (struct rb_vm_struct): replaced signal staff with trapnobu2008-09-041-6/+6
| | | | | | | | | | | | | | | | | | | | staff. * signal.c (signal_buff): per process resouce now. * signal.c (trap_list): moved to VM. * signal.c (rb_get_next_signal): reverted. * signal.c (rb_trap_exit): trap_pending_list was no longer used. * thread.c (timer_thread_function): delivers buffered per-process signals to each VMs. * vm.c (rb_vm_mark): marks trap_list. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19119 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* fix a typo.akr2008-08-311-1/+1
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18988 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/intern.h: rename RB_UBF_DFL toko12008-08-311-2/+2
| | | | | | | | | | RUBY_UBF_IO and RUBY_UBF_PROCESS. Because there is no default (universal) unblocking function. * ext/socket/socket.c, file.c, io.c, process.c, thread.c: ditto. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18985 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/ruby.h (rb_intern_const): tiny optimization.nobu2008-08-161-0/+1
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18653 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * thread.c (rb_thread_priority_set): get rid of C99 feature.nobu2008-08-141-1/+1
| | | | | | | * transcode.c (transcode_search_path): ditto. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18606 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * thread.c (rb_thread_execute_interrupts): switch eventko12008-08-131-5/+1
| | | | | | | | should be occur only once. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18596 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * thread.c (rb_thread_check_ints): added. please note thatko12008-08-131-0/+13
| | | | | | | | | | | this function may cause ruby's thread switching. * include/ruby/intern.h: ditto. * regint.h: use rb_thread_check_ints() instead of RUBY_CHECK_INTS() directly. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18572 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * thread.c, vm_core.h: add manual priority supportko12008-08-131-1/+38
| | | | | | | | | | | using time slice. if you enable USE_NATIVE_THREAD_PRIORITY macro, this mechanism is ignored. [ruby-dev:33124] * thread_pthread.c, thread_win32.c: ditto. * test/ruby/test_thread.rb: fix test parameter. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18570 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * thread.c (thread_start_func_2): propagates fatal error and systemnobu2008-08-051-5/+19
| | | | | | | exit to the main thread. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18381 b2dd03c8-39d4-4d8f-98ff-823fe69b080e