Skip to content

Instantly share code, notes, and snippets.

@hankliu5
Created February 13, 2019 03:40
Show Gist options
  • Select an option

  • Save hankliu5/b6b0ac7fb2894b0b0e52dd39075ca520 to your computer and use it in GitHub Desktop.

Select an option

Save hankliu5/b6b0ac7fb2894b0b0e52dd39075ca520 to your computer and use it in GitHub Desktop.

Revisions

  1. hankliu5 created this gist Feb 13, 2019.
    6 changes: 6 additions & 0 deletions thread_append.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,6 @@
    array = Array.new()
    t1 = Thread.new { array.append(4) }
    t2 = Thread.new { array.append(7) }
    t1.join
    t2.join
    puts array.size