Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I'm developing a telecom messaging platform in C, and I'm going to need multiple processes to be working with MySQL DB.

How can I make two processes read/write to/from a Mysql DB and, if/when one of them goes down, get the other to seamlessly take over the work until the dead process gets back to work? I was thinking/googling some options and am stuck in place where I don't know which one to choose.

What I think so far is that table lock is not the best option to go for, as it will stall the other process until the table is unlocked. The other option is to use row-level locks or manual locks, but I can't find the best way to do it.

share|improve this question
1  
just a comment, check out Erlang/OTP as a language it was built to do this kind of stuff. –  Zachary K Mar 21 '12 at 8:27
    
So this question is about 2 (or more) threads talking to MySQL over the same connection? –  N.B. Apr 20 '12 at 10:47
    
If my answer fit you, please feel free to upvote it. Thanks in advance ^^ –  Pascal Qyy Nov 2 '13 at 10:50
add comment

2 Answers

MySQL should automatically unlock the tables (and if you're using a transactional table type it'll do something with the transaction - either roll back or commit depending on options etc) when the second process dies (since the connection will drop.) If your question is about having two processes for reliability working on a single work queue, that info may help?

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.