WIN32OLE taking 100% CPU utilisation

Hi there,

just having a quick play with WIN32OLE and it looks like the
message_loop is taking 100% CPU utilisation. What have I done wrong?
This is running on ruby 1.9.2p136 in WinXP and using Office 2007.

http://pastie.org/3004860

Thanks.

The Perl version works with no such issues so I’m using that for now.

do all versions of ruby do the same thing?

On Dec 12, 2011, at 6:24 AM, Shareef J. wrote:

Hi there,

just having a quick play with WIN32OLE and it looks like the
message_loop is taking 100% CPU utilisation. What have I done wrong?
This is running on ruby 1.9.2p136 in WinXP and using Office 2007.

http://pastie.org/3004860

This is how #message_loop is supposed to work. It polls the Win32 event
sink and processes all of the events that are in queue. Try putting a
short sleep in your “loop do” like “sleep(0.1) # 100 ms”.

Your code won’t run much slower but the CPU utilization will be lower.

cr

Roger P. wrote in post #1036348:

do all versions of ruby do the same thing?

Sorry, missed these replies. Not tried any more versions I’m affraid -
if I ever try again I will post here but I have it working in Perl for
now.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs