Skip to content

Commit

Permalink
don't use thread until you know how to use queue/work/callback
Browse files Browse the repository at this point in the history
  • Loading branch information
marguerite committed Nov 17, 2014
1 parent c3a33a1 commit 37de59e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
4 changes: 0 additions & 4 deletions BiliFile.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ module BiliFile

def biliMove(file, newfile=file, condition)

Thread.new {

tmp = file + ".tmp"

open(file, 'r') do |f0|
Expand Down Expand Up @@ -44,8 +42,6 @@ def biliMove(file, newfile=file, condition)
end

FileUtils.mv tmp, newfile

}

end

Expand Down
8 changes: 3 additions & 5 deletions BiliWeb.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,9 @@ def initialize(url="http://bilibili.tv")
end

def get
thr = Thread.new {
content = open(@url).read
io = File.open(@filename, "w")
io.puts(content)
io.close }
content = open(@url).read
io = File.open(@filename, "w")
io.puts(content)

clean
end
Expand Down

0 comments on commit 37de59e

Please sign in to comment.