in reply to Re: Re: Re: Threads problem.
in thread Threads problem.

Thanks for your reply,

I am sure I am doing something silly here, but when I run the script and supplying c:\ as the only argument, I get this error in return;
C:\Scripts>pm_threads_ex4.pl c:\ Free to wrong pool 1659fb0 not 15e02e0 during global destruction.
I am not sure yet on how to proceed from this point on.

Cheers.

Replies are listed 'Best First'.
Re: Re: Re: Re: Re: Threads problem.
by BrowserUk (Patriarch) on Oct 07, 2003 at 19:56 UTC

    I think that was a bug in 5.8.0 that was fixed for 5.8.1. I will take a look later and try and find the reference at perl.org (I have to go now for an hour or so).

    If memory serves me correctly, the error only occurs as the program terminates and cleans up the threads, and doesn't actually effect the runtime operation of the program. I seem to recall resorting to adding POSIX::_exit() at the end of the program to avoid the problem occuring.

    I'll take another look later and try to confirm my memory.


    Examine what is said, not who speaks.
    "Efficiency is intelligent laziness." -David Dunham
    "Think for yourself!" - Abigail

Re: Re: Re: Re: Re: Threads problem.
by BrowserUk (Patriarch) on Oct 07, 2003 at 23:29 UTC

    Despite my best efforts, I can't locate the patch that fixed the "Free to wrong pool" error during thread cleanup. I found this reference plus some others, but not the patch. I find it pretty difficult to find anything on the myriad perl.org lists, archives, news feeds and RT system. Maybe I just go about it the wrong way?

    Anyway, you can work around the problem by replacing the line

    $_->join for @threads;

    with

    use POSIX qw[_exit]; _exit 0;

    This simply bypasses the thread cleanup code in perl and leaves the OS to clean up the mess, which it does without the associated message and segfault.

    You could also upgrade to 5.8.1 but that means building perl, plus Win32::OLE yourself which is non-trivial, and the _exit() "fix" is simple and effective.

    HTH.


    Examine what is said, not who speaks.
    "Efficiency is intelligent laziness." -David Dunham
    "Think for yourself!" - Abigail

      HHHHOOOOOO WWWWWEEEEEEE....This mother of a code is SMOKIN!

      Thanks alot BrowserUK my friend,....I try few things with this beautiful code and get back with my findings.

      :DDDDDDDDDD