title: MySQL: Transactions across multiple threads
body: <p><strong>Preliminary</strong>: </p>
  
  <p>I have an application which maintains a thread pool of about 100 threads. Each thread can last about 1-30 seconds before a new task replaces it. When a thread ends, that thread will almost always will result in inserting 1-3 records into a table, this table is used by all of the threads. Right now, no transactional support exists, but I am trying to add that now. Also, the table in question is InnoDB. So...</p>
  
  <p><strong>Goal</strong></p>
  
  <p>I want to implement a transaction for this. The rules for whether or not this transaction commits or rollback reside in the main thread. Basically there is a simple function that will return a boolean.</p>
  
  <ol>
  <li>Can I implement a transaction across multiple connections?</li>
  <li>If not, can multiple threads share the same connection? (Note: there are a LOT of inserts going on here, and that is a requirement).</li>
  </ol>