Re: How do I stop a thread
Wan-Teh Chang <[email protected]> Thu, 29 Jan 2009 12:13:49 -0800
| Newsgroups | gmane.comp.mozilla.devel.nspr |
|---|---|
| Message-ID | <[email protected]> |
Sorry about the late reply. On Wed, Jan 7, 2009 at 10:58 PM, Sabyasachi Ruj <[email protected]> wrote: > How should I interrupt and stop a thread. > I am not able to do with PR_interrupt(); > > Details: - > I have a thread, which will connect to a MySQL proxy server. > > There is a bug in MySQL proxy: - > http://bugs.mysql.com/bug.php?id=41417 > In short, if the MySQL server is stopped, the mysql_real_connect hangs. > > Due to this bug, my thread goes to state where it never comes out of > mysql_real_connect. > > Now, the PR_interrupt is also not able to interrupt that thread. Yes. PR_Interrupt can only interrupt NSPR functions, such as PR_WaitCondVar and PR_Connect. It can't interrupt mysql_real_connect. > Somehow I need to stop that thread. > How should I do it? I don't know how to interrupt mysql_real_connect. Is there a mysql function to do that? If not, you can try pthread_cancel on Unix/Linux/Mac OS X. Wan-Teh