in reply to Re: Re: Activestate 5.8.2 broke my threads :(
in thread Activestate 5.8.2 broke my threads :(

I have considered moving threads->detach() on a separate line before I made my original post though, but moving detach on to another line is not doing what you think it's doing. The following codes are not equivalent:
threads->create(\&create_threads, "param")->detach();
and
threads->create(\&create_threads, "param"); threads->detach();
In the first example, detach() is performed on the object returned by threads->create(), which detaches the thread created. Moving detach() on a separate line does not detach the thread at all, calling threads->detach() separately has no effect on the thread you just created.

The proof? Well, there is a threads->list() function that lists all non-joined, non-detached threads. Add threads->list() after threads->detach() showed that the created thread did not get detached at all.

I agree there is definitely a bug with detach() on out of scope object, but moving detach() on a separate line is not a fix. You must call $thread_created->detach() to truly detach the thread.

Replies are listed 'Best First'.
Re: Re: Re: Re: Activestate 5.8.2 broke my threads :(
by Anonymous Monk on Dec 23, 2003 at 00:05 UTC
    Roger,

    Thanks again for your time and effort. Your help was to the point. Much appreciated.

    Alas, you were right that the threads were not detached, so Perl didn't crash as apparently the detach() causes it. With the proper detach(), even on separate line, Perl crashs again :(

    Also crashes if I move the detach to inside the thread

    threads->self->detach();

    Now if only AS will fix the problems in Windows Perl v5.8.2 soon or I will have to fall back to 5.8.0:(