Emmanuel,

I think you're right: something isn't quite right about the detach method.
In Jez's example, there doesn't seem to be any difference if you comment out
the call to the method or not.

A couple of other lines from the manual:

"If the program exits without all other threads having been either joined or
detached, then a warning will be issued."

"If you don't want the return values and don't want to wait for the thread
to finish, you should call the detach() method instead, as described next."

So I'm pretty sure that we shouldn't see the error message when exiting the
main thread after having called detach() but, to be fair, nothing worse than
the error message seems to happen. I was afraid that the problem was in
Win32::GUI, but you see the same behaviour in a non-GUI program.

All the best,
Glenn

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Emmanuel E
Sent: Friday, 30 December, 2005 12:51
To: perl-win32-gui-users@lists.sourceforge.net
Subject: Re: [perl-win32-gui-users] PerlApp issue

Rob's work sounds cool!

About the threads exiting issue this is what the manual page says:
-------------
WARNINGS
  A thread exited while %d other threads were still running

  A thread (not necessarily the main thread) exited while there were still 
other threads running. Usually it's a good idea to first collect the return 
values of the created threads by joining them, and only then exit from the 
main thread.
-------------

In my experience the detach method seems to be experimental. The main thread

exiting before other threads causes the entire script to exit. Also a thread

using the Crypt::SSLeay or Net::SSLeay module, causes weird crashes if 
detached, but works "reasonably" okay if not detached. Hopefully this will 
be fixed in a later version of Perl and/or SSL modules!

Cheers,
Emmanuel

p.s. Wishing you all a great year ahead.

----- Original Message ----- 
From: "Jeremy White" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>; 
<perl-win32-gui-users@lists.sourceforge.net>
Sent: Friday, December 30, 2005 8:31 PM
Subject: RE: [perl-win32-gui-users] PerlApp issue


>>One thing I noticed in my program, that also occurs when I run your 
>>example,
>>is that I get a message complaining that "A thread exited while 6 threads
>>were running" if the main window is exited first. I thought the detach()
>>method was supposed to prevent that. I seem to remember that when you
>>actually do a join(), as suggested in the documentation, there are other
>>problems. Do you also see this? Do you know what is going wrong?
>
> Yes I get this too. I think that the message is mainly a warning, and in 
> most simple cases can be ignored. The correct approach is for all child 
> threads to terminate smoothly, under the control of the main thread before

> the main thread itself terminates.
>
> Cheers,
>
> jez. 



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Perl-Win32-GUI-Users mailing list
Perl-Win32-GUI-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users
http://perl-win32-gui.sourceforge.net/


Reply via email to