timer examples

M

Mathspeedy

Hi !
I think the title says it all,
I would like to see some timer examples,
just for fun =D
 
B

Bertram Scharpf

Hi,

Am Mittwoch, 22. Jul 2009, 07:25:14 +0900 schrieb Mathspeedy:
I think the title says it all,
I would like to see some timer examples,

I examined the whole interpreter source code and could not find
any way to call alarm() or setitimer() by Ruby methods. I really
miss that!

Bertram
 
X

Xeno Campanoli

Bertram said:
Hi,

Am Mittwoch, 22. Jul 2009, 07:25:14 +0900 schrieb Mathspeedy:

I examined the whole interpreter source code and could not find
any way to call alarm() or setitimer() by Ruby methods. I really
miss that!

Bertram
There's a Timeout method I use that has been superior to anything I could find
in Python, and was a reason for me using Ruby instead at one point:
begin
Timeout::timeout(OverallTimeout) do |tl|
# Until I find out what this is, Screw it!
# No doc on tl anymore!
#puts "tl: #{tl}"
probe_threads.each { |t| t.join }
puts "All probe threads collected."
end
rescue Timeout::Error => eo
puts "#{eo.message}, exiting before joining all probe threads."
end

As you see by my comment above, some of the docs are not to my satisfaction.
Still, I have been using this happily since 2007.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top