Win32OLE_EVENT and threading

Hi,

I have a application which recieves events asynchronously.

The event processing is done as such:

    Thread.new do
      ev = WIN32OLE_EVENT.new(@provider, '_IDataProviderEvents')
      ev.on_event {|*args| event_handler(*args)}
      ev.on_event("OnDataAvailable") { |datapacket| received(datapacket) }
      loop do
        WIN32OLE_EVENT.message_loop
        sleep(0.1)
      end
    end

I have to use the sleep, or else the CPU runs at 100%. However, this
limits me to 10 messages/second, which may be more.

I'm experimenting with other values for sleep, but I have a feeling
there's a better way.

Can't I just ask message_loop to hang until there is a message?

//F