in reply to Re: Why do my threads sometimes die silenty?
in thread Why do my threads sometimes die silenty?
When executed as is, it produces the following output:use strict; use threads; use threads::shared; my $fct = sub { # eval {require Blah; Blah->import()} or print $@; require Blah; Blah->import(); }; my $thr = threads->new($fct); #$thr->join();
If I remove the comment in front of the last line (the join call), then I get error message:Perl exited with active threads: 1 running and unjoined 0 finished and unjoined 0 running and detached
Note also that the eval {} trick doesn't seem to make any difference. In other words, if I remove the comment in from of the eval {} line but leave the join() statement commented out, I still don't get the error message. Note also that the silent dying does not happen if, for example, the error is caused by a division by zero instead of a non-existant include file. Also interesting is the fact that if I do "use Blah;" instead of "require Blah; Blah->import()", then I see the error message, even if the join call is commented out. In case you are wondering why I use a require instead of use, it's because loading the Blah module may end up loading modules which are not thread-safe. Therefore, I want to load the module at run-time, not at compile time (as explained on this node: http://www.perlmonks.org/?node_id=288022).Thread 1 terminated abnormally: Can't locate Blah.pm in @INC (@INC con +tains: etc...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Why do my threads sometimes die silenty?
by BrowserUk (Patriarch) on Sep 21, 2011 at 20:38 UTC | |
by alain_desilets (Beadle) on Sep 21, 2011 at 21:00 UTC | |
by BrowserUk (Patriarch) on Sep 21, 2011 at 21:09 UTC | |
by alain_desilets (Beadle) on Sep 21, 2011 at 21:25 UTC | |
by BrowserUk (Patriarch) on Sep 21, 2011 at 21:42 UTC | |
| |
by alain_desilets (Beadle) on Sep 21, 2011 at 21:22 UTC | |
by BrowserUk (Patriarch) on Sep 21, 2011 at 21:33 UTC | |
by alain_desilets (Beadle) on Sep 22, 2011 at 18:10 UTC | |
|