Ruby SystemTimer gem for Windows

Posted in code, ruby on rails by mtjhax on December 23, 2010

SystemTimer is a Gem that replaces timeout.rb and fixes some potentially serious flaws when accessing system resources (e.g., when communicating with remote APIs) in Linux/Posix environments. In a nutshell, timeout.rb uses Ruby pseudo-threads (“green threads”) that are not guaranteed to be given the same equal opportunities in the CPU as real system threads, resulting in synchronization problems. Visit for all the details.

If you end up needing to use SystemTimer on your production environment and you develop on Windows, you have a problem. SystemTimer’s documentation says that it can be installed under Windows (providing the same interface for your code but not really changing anything — it just acts as a wrapper to timeout.rb). In practice, however, trying to “gem install SystemTimer” results in errors building the native extensions even if you have the RubyInstaller DevKit installed.

Solution? Simple! I don’t know who ghazel is but my hat’s off to them. They took the time to branch the SystemTimer project, patch it to install under Windows and simply provide the wrapper classes without trying to compile anything, and put it up on

Visit or just “gem install ghazel-SystemTimer” and you should be good to go on your Windows development box in about two seconds.


3 Responses

Subscribe to comments with RSS.

  1. F G said, on December 12, 2011 at 1:08 am

    Thank all the gods for you. One year after your post and my weekend is no longer ruined. My tears of anguish are now tears of joy. Time for a great deal of beer.

  2. neil said, on April 24, 2012 at 12:18 pm

    Hmm. Does not help in conjuntction with REDIS

    • mtjhax said, on April 24, 2012 at 5:31 pm

      I don’t really understand — what does your database have to do with installing a system timer gem? If there’s a problem post it on the ghazel-SystemTimer page and maybe someone can help. I just linked to it, but I’m not one of the contributors.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: