Skip to content
This repository has been archived by the owner on Jun 21, 2023. It is now read-only.

Commit

Permalink
Don't use Titan::Thread#id= for setting up a new thread because it wi…
Browse files Browse the repository at this point in the history
…ll cause a synchronization with the file system
  • Loading branch information
flippingbits committed Dec 4, 2010
1 parent d7f43cc commit a5ee8b2
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions lib/titan/thread.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ def initialize(options = {}, &block)
@id = options[:id] || __id__
@pid = -1
@programm = block
save

@@threads[@id] = self
self
end

Expand Down Expand Up @@ -77,8 +76,8 @@ def run
# exit the forked process cleanly
Kernel.exit!
end

Process.detach(@pid)
save
self
end

Expand Down Expand Up @@ -109,9 +108,8 @@ def all
def load_threads
check_filesystem
pid_files.each{ |pid_file|
thread = Titan::Thread.new
thread = Titan::Thread.new(:id => File.basename(pid_file, ".pid"))
thread.pid = File.read(File.expand_path(pid_file, TITAN_DIRECTORY))
thread.id = pid_file.delete(".pid")
@@threads[thread.id] = thread
}
end
Expand Down

0 comments on commit a5ee8b2

Please sign in to comment.