Firstly, thanks everyone and BrowserUK for the responses. Below are my responses to select parts of the follow-ups.

1.BrowserUK wrote:
However--and this is my recommendation--based on the pseudo-code you've posted which suggests the threads in question have no clean up to perform, nor any values to return, I would suggest upgrading to (the binary compatible) 5.8.9 and detaching the threads.

Well, I am to blame here. The pseudo-code, as expected, did not reveal much. This code below is declared before any thread is defined at the very top of the program. In effect, what I have done is to declare redirects for STDOUT and STDERR to a log file. And this is shared by all threads.

# Opening log file. # Redirecting OUTPUT and ERR to log file for all threads open OUTPUT, '>>', "/usr/local/xxx/log/lease.log" or die $!; open ERROR, '>>', "/usr/local/xxx/log/lease.log" or die $!; STDOUT->fdopen( \*OUTPUT, 'w' ) or die $!; STDERR->fdopen( \*ERROR, 'w' ) or die $!;

This simplifies my logging process but it, in turn creates problems when I shut the daemon down. Please keep in mind the the signal handler itself is shared by all threads which means each process has it's signal handlers defined. So what I needed to write in the signal handler was a clean closing of threads and file-handles, independent of the active thread. I thought about something similar to $timetoExit before posting here but did not know how to get beyond that point. The sleep 1 and next while --$sleepTime; was what I was looking for. Saw it. Loved it. Tested it with a mild tweak. And no more error messages.

2.BrowserUK wrote:
Detached threads are, by definition, fire-and-forget, so the earlier warnings were just wrong.

I did try detaching the thread. But the error message kept coming. And I was also worried about the open file handles in the async thread. I kept imagining the main thread receiving a SIGTERM while the sync thread was trying to write to the file-handle. I believe this is a possibility.


In reply to Re^2: Perl5.8.4 , threads - Killing the "async" kid by MonkeyMonk
in thread Perl5.8.4 , threads - Killing the "async" kid by MonkeyMonk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.