Here’s my first RubyForge release, a small utility that wraps around the
POSIX
timer API. This is only available for systems which implement
timer_create()
calls - Linux being where I’ve tested it on.
It’s very simple: create a new timer, arm it, and after a certain number
of
seconds it will trigger a signal to your application:
timer = Posix::Timer.new
timer.arm(10.0)
do some stuff for 10 seconds
10 seconds later => SignalException
You can specify a different signal than the default SIGALRM:
Posix::Timer.new(“USR1”)
or you can pass a block to the initializer and have it executed upon
timeout:
a = Posix::Timer.new do
puts “hi”
raise MyCustomException
end
a.arm(10.0)
10 seconds later => MyCustomException
Other features:
a.disarm # disarm the timer
a.armed? # true or false
a.timeout # return number of seconds until timer expires
Caveats
The Posix::Timer instance uses POSIX signals to trigger
the timeouts. This may conflict with other signals you wish to
use in your application.
Passing a block to the constructor will perform a Signal.trap on
the signal. This may override an existing Signal.trap. In a future
version I intend to rollback the previous trap context.
Multiple timers using the same signal may conflict.
I’d be really interested in knowing how this performs compared to simply
using using ruby threads and #sleep (e.g. timeout.rb or similar
mechanisms). In a lightly/moderately/heavily loaded environment, are the
timing errors worse or better? How about reliability? If there are
several posix timers armed, do signals get lost if one handler is
running while another expires?
I’d be really interested in knowing how this performs compared to simply
using using ruby threads and #sleep (e.g. timeout.rb or similar
mechanisms). In a lightly/moderately/heavily loaded environment, are the
timing errors worse or better? How about reliability? If there are
several posix timers armed, do signals get lost if one handler is
running while another expires?
I have a feeling it’s implementation dependent. I’ll plan to run a few
tests
on it to see what kind of performance I get, though.
How about reliability? If there are
several posix timers armed, do signals get lost if one handler is
running while another expires?
It depends on the kind of signal used. For posix timers, it is
recommended
to use real-time signals, because they are queued.
OK - Here’s my issue
My Outlook Expres is getting bogged down by the 50,000 or so emails I
have
on Ruby and Rails ml’s.
I find searching these lists a valuable source of information.
I tried to search the archives directly, and my impression is the search
engine was slow and unreliable.
How do you all solve this problem, since it must be a common issue.
??
OK - Here’s my issue
My Outlook Expres is getting bogged down by the 50,000 or so emails I
have
on Ruby and Rails ml’s.
I find searching these lists a valuable source of information.
I tried to search the archives directly, and my impression is the search
engine was slow and unreliable.
How do you all solve this problem, since it must be a common issue.
??
Google with the site: parameter.
By the way, it looks like may have committed the dreaded
‘thread hijack attack’ where you reply to an unrelated
message. This may cause a problem with threading mailreaders
(as well as the archives) so try to avoid it
OK - Here’s my issue
My Outlook Expres is getting bogged down by the 50,000 or so emails I have
on Ruby and Rails ml’s.
I find searching these lists a valuable source of information.
I tried to search the archives directly, and my impression is the search
engine was slow and unreliable.
How do you all solve this problem, since it must be a common issue.
??
Some of us use gmail. It’s an excellent way to read lists. Can send
you an invite if you like.
Some of us use gmail. It’s an excellent way to read lists. Can send
you an invite if you like.
I use Gmail and generally love it, but two annoying things for anyone
considering using it to view lists:
It doesn’t thread
It sends you a copy of your own messages you’ve sent, giving the
appearance of double posts.
(unless you set up a filter, then you dont see your posts at ALL
On the good side of things, the search is wonderful and it’s very easy
to set up filters for various things. Of course, thunderbird has
good things going for it too, but if you’re on many computers in the
course of a day. (I constantly mention that I frequent five different
OSes in the course of a day), having a web based system is great.
You can also search the mailing lists on google groups or ruby-forum.com
OK - Here’s my issue
My Outlook Expres is getting bogged down by the 50,000 or so emails I have
on Ruby and Rails ml’s.
I find searching these lists a valuable source of information.
I tried to search the archives directly, and my impression is the search
engine was slow and unreliable.
This is a major win for Redmond: Outlook Express scales!
Searching is art and science. The basic problems are
polysemy/synonymy, which are loosely related to precision/recall ( i
actually believe reading the lucene book will help you formulate better
searches, you see both sides of the coin)… Basically you need to
define a subset of c.l.ruby to search, and think of all the synonyms
you can. A hash is a dict/mapping/associative array. There are data
structures named lists, arrays, containers, queues, sets, stacks, bags,
enumerations, ring buffers, deques, linked lists, heaps etc. etc.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.