# Win32-service 0.5.2

**URL:** <https://www.ruby-forum.com/t/win32-service-0-5-2/77258>\
**Category:** Ruby\
**Created:** [November 25, 2006, 7:11pm UTC](https://www.ruby-forum.com/t/win32-service-0-5-2/77258 "2006-11-25T19:11:29Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![danielb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/c57346/32.png) [@danielb](https://www.ruby-forum.com/u/danielb)\
**Post date:** [November 25, 2006, 7:11pm UTC](https://www.ruby-forum.com/t/win32-service-0-5-2/77258/1 "2006-11-25T19:11:29Z")

</div>

Hi all,

The Win32Utils Team is happy to announce the release of win32-service  
0.5.2. Normally I don’t announce minor releases, but this one contains  
a fix for the dreaded thread blocking issue (you know, where you would  
call Service.stop, and the your Daemon would just kinda hang).

Many thanks go to Patrick H. for his patch.

You can find it on the RAA (as win32-service) or on RubyForge (as part  
of the win32utils project).

But wait! There are other goodies, too:

- I’ve added the Daemon#running? helper method for use within your  
service\_main code. So, your Daemon class should generally always look  
something like this:

class Daemon  
def service\_main  
while running?  
if state == RUNNING # As opposed to IDLE or PAUSED  
# Your loop here  
else  
sleep 1  
end  
end  
end  
end

- I’ve scrapped the old daemon example code in the ‘example’  
subdirectory (which didn’t actually work) and replaced it with two  
separate files - tdaemon.rb and tdaemon\_ctl.rb. It’s a simple service  
that writes a short text message to your c:\ drive every 5 seconds.  
Oh, and it actually works. 🙂

- There’s now a gem (that we host). This is a C extension, so you’ll  
still need a C compiler to build and install the gem. If you don’t  
have a C compiler, you can download the shared object directly from the  
project page at  
[http://rubyforge.org/frs/download.php/15016/service-0.5.2-vc6.so](http://rubyforge.org/frs/download.php/15016/service-0.5.2-vc6.so).  
Rename the file to just “service.so” and copy it manually to  
c:\ruby\lib\ruby\1.8\i386-mswin32\win32.

That’s it for now. Enjoy!

The Win32Utils Team
