Project

General

Profile

Actions

Bug #1499

closed

Commit 22478 has "that can't be right!" defect in rb_thread_schedule.

Added by JohnCarter (John Carter) over 15 years ago. Updated over 13 years ago.

Status:
Closed
Target version:
-
ruby -v:
ruby 1.8.7 (2009-04-08 patchlevel 160) [i686-linux]
[ruby-core:23515]

Description

=begin
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8_7/eval.c?view=diff&r1=22477&r2=22478

  •           if (th == th_found) {
    
  •                th_found->status = THREAD_RUNNABLE;
    
  •                th_found->wait_for = 0;
    
  •                if (th->wait_for&WAIT_FD) {
    
  •                    th_found->fd = 0;
    
  •                }
    
  •                else { /* th->wait_for&WAIT_SELECT */
    
  •                    n = intersect_fds(&readfds, &th_found->readfds, max) +
    
  •                        intersect_fds(&writefds, &th_found->writefds, max) +
    
  •                        intersect_fds(&exceptfds, &th_found->exceptfds, max);
    
  •                    th_found->select_value = n;
    
  •                }
    
  •            }
    
  •      next = th;
    

but but since th == th_found

  •                th_found->wait_for = 0;
    
  •                if (th->wait_for&WAIT_FD) {
    

means that if is ALWAYS going to fail!

I'm not sure what the correct code is... but I'm guessing it is move the th->wait_for = 0 to after the ifs.
=end

Actions

Also available in: Atom PDF

Like0
Like0Like0