Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Sorry for being vague. What I mean is that if the program is in the middle of processing the 3rd element in the stack and it receives an interrupt signal, I'd like it to finish the 3rd element and ONLY the third element before it exits. I don't want it to continue processing past that point.

The processing is such that the element is shift()ed off the stack (duh), then sent to a function that will print to a log file, and send the element to a package for processing via DBI and DBD::ODBC (Access DB...meh!).

Originally I was using threads, because I thought I might be able to process multiple stack elements simultaneously, but then the DBI docs said that wasn't a good idea.

If the DBI and drivers are loaded and handles created before the thread is created then it will get a cloned copy of the DBI, the drivers and the handles.

However, the internal pointer data within the handles will refer to the DBI and drivers in the original interpreter. Using those handles in the new interpreter thread is not safe, so the DBI detects this and croaks on any method call using handles that don't belong to the current thread (except for DESTROY).

I'm about to stop using threads, though I haven't yet because I wasn't sure if I couldn't use them somehow to monitor results from the processing. But then, since I'm only able to go one at a time anyway, I might as well just kill the threads stuff now.

I won't pretend that I wasn't a bit curious to play with threads. However, if this is is a bad practice then lesson learned and I'll go another route.


dsb
This @ISA my( $cool ) %SIG

In reply to Re^2: Handle Signal and Wrap Up by dsb
in thread Handle Signal and Wrap Up by dsb

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (5)
As of 2024-04-19 04:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found