Yes. I see exactly the behaviour you describe. Everything seems to run fine, but it never exits. This isn't a surprise. For example, if the OLE code uses the process ID to key stuff off internally, calling it multiple times from the same process on different threads is going to confuse it. And a brief look with a debugger at what is going on, seems to indicate that OLE is getting very confused.

There are no less that 9 threads running in the process, after your 3 have terminated. Of those, 4 are sitting in RegisterWaitForInputIdle wait states, and will never be awoken.

I won't pretend to have looked into this very far, but it seems safe to say that using Win32::OLE in conjunction with threads is a no no. At least, if you call OLE from multiple threads.

It's possible, but I haven't tried it, that like several other packages--Tk, DBI etc.--you might get away with using it in conjunction with threads, provided that you only call it from one thread. It may be that it would only work if you only call it from the initial thread.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
"Too many [] have been sedated by an oppressive environment of political correctness and risk aversion."

In reply to Re: Win32::OLE and threads by BrowserUk
in thread Win32::OLE and threads by bsdz

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.