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...
In reply to Re^2: Why do my threads sometimes die silenty?
by alain_desilets
in thread Why do my threads sometimes die silenty?
by alain_desilets
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |