in reply to Re: Re: Re: Re: Re: Starting multi-threading
in thread Starting multi-threading

The most important thing to get standard modules thread-safe, is to look at the CLONE {} dummy sub. This is called before the thread is cloned. However, this still takes place inside the environment of the original thread, which may not always what you want. Which was one of the reasons for creating Thread::Exit.

So if there is some cloning to do to get thread-safe, first try to get it done with CLONE {}, if that fails try with Thread::Exit.

Yet another approach could be to load Win32::OLE inside each thread. You can either require inside the thread, or use (you guessed it): Thread::Use, which allows you to say:

useit Win32::OLE;
where useit stands for "use inside thread".

Hope this helps someone looking at making Win32::OLE thread-safe.

Liz

Replies are listed 'Best First'.
Re: Re: Re: Re: Re: Re: Re: Starting multi-threading
by BrowserUk (Patriarch) on Aug 24, 2003 at 21:37 UTC

    That helps:) Using Thread::Use and useit Win32::OLE; stops perl from segfaulting when the thread terminates, and gets rid of the "Free to wrong pool" error.

    I'm still getting errors (from Win32::OLE) when calling some methods within the Scripting Object. I know the Scripting Object can be used on multiple threads from within VB, so its a case of trying to track down where the conflict lies. I might get time for this later if my current project gets under my skin--which it is beginning to:(


    Examine what is said, not who speaks.
    "Efficiency is intelligent laziness." -David Dunham
    "When I'm working on a problem, I never think about beauty. I think only how to solve the problem. But when I have finished, if the solution is not beautiful, I know it is wrong." -Richard Buckminster Fuller
    If I understand your problem, I can solve it! Of course, the same can be said for you.