Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^4: Interrupting a blocking read (Linux::Inotify2) with a signal handler within a thread

by clueless newbie (Friar)
on Sep 10, 2011 at 20:40 UTC ( #925286=note: print w/ replies, xml ) Need Help??


in reply to Re^3: Interrupting a blocking read (Linux::Inotify2) with a signal handler within a thread
in thread Interrupting a blocking read (Linux::Inotify2) with a signal handler within a thread

That seems to be the best way to "get-her-done", but it galls me that I don't understand how to get a signal handler in a thread to work!

I thank you for your help.


Comment on Re^4: Interrupting a blocking read (Linux::Inotify2) with a signal handler within a thread
Re^5: Interrupting a blocking read (Linux::Inotify2) with a signal handler within a thread
by BrowserUk (Pope) on Sep 10, 2011 at 20:53 UTC
    it galls me that I don't understand how to get a signal handler in a thread to work

    The short answer is that they don't work in threads. Signals are sent to the process, not individual threads within it. The salient part of the relevant documentation for linux reads:

    A signal's disposition within a process's context defines what action the system will take on behalf of the process when a signal is delivered. All threads and LWPs (lightweight processes) within a process share the signal disposition, which is processwide and cannot be unique among threads within the same process.

    That said, threads belatedly acquired some additions that attempt to allow "inter-thread signalling", but in my limited experience of trying to use them, they are essentially useless, as they won't actually interrupt anything -- you have to poll to see if they have been received.


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.

      Thanks, that explains why "I removed the Linux::Inotify2 code from the Watchdog and but still couldn't get either form of the signal handlers to work!".

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://925286]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (10)
As of 2014-09-16 22:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (51 votes), past polls