Project

General

Profile

Actions

Bug #3585

closed

The "p" method is printing a string twice when using threads.

Added by orangea (Adrian Bloomer) over 13 years ago. Updated over 4 years ago.

Status:
Closed
ruby -v:
r28630 darwin
[ruby-core:31348]

Description

=begin
When I run this code:

 t = Thread.new { sleep 3 }
 Thread.new { sleep 2; t.kill; p 'hi!' }
 t.join

I would expect "hi!" to be printed once. But, when I put the code in a file and run it with ruby somefile.rb, "hi!" gets printed twice. This does not happen if I just type ruby and paste the code in and press Control-D. I posted a question on StackOverflow about it ( http://stackoverflow.com/questions/3277775/why-does-this-code-print-the-same-thing-twice ). The person who commented said that they got it too. My ruby -v is ruby 1.9.1p378 (2010-01-10 revision 26273) [i386-darwin10], and the other person who experienced it said that they have ruby 1.9.3dev (2010-07-19 trunk 28679) [x86_64-darwin10.4.0].
=end


Files

test.rb (73 Bytes) test.rb orangea (Adrian Bloomer), 07/19/2010 01:00 PM
Actions #1

Updated by nobu (Nobuyoshi Nakada) over 13 years ago

  • Category set to core
  • Target version set to 1.9.2
  • ruby -v set to r28630 darwin

=begin

=end

Actions #2

Updated by nobu (Nobuyoshi Nakada) over 13 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

=begin
This issue was solved with changeset r28687.
Adrian, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.

=end

Actions #3

Updated by nobu (Nobuyoshi Nakada) over 13 years ago

  • Status changed from Closed to Assigned
  • Assignee set to yugui (Yuki Sonoda)

=begin
Needs to be backported to 1.9.1 too.
=end

Actions #4

Updated by jeremyevans0 (Jeremy Evans) over 4 years ago

  • Description updated (diff)
  • Status changed from Assigned to Closed
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0