| Author |
atomic block of code?
|
david zhang
Greenhorn
Joined: Oct 12, 2003
Posts: 27
|
|
Hi, I am coding an application. It has a thread that can be requested to stop any time during its execution. Inside the thread, there are a few lines of code that should be executed all or none. In another word, if the thread runs in the middle of this block, then outside interrupt/stop request should not stop the thread before the block finishes. How can this be accomplished? This block of code has nothing to do with database write. Thanks, David
|
 |
Ernest Friedman-Hill
author and iconoclast
Marshal
Joined: Jul 08, 2003
Posts: 24039
|
|
|
Depends on how the "request to stop" is being made. If you're using the deprecated stop() method, then I don't believe there's anything you can do. If you're using interrupt() or a "stop flag" of your own devising, then you simply need to not check these things during the block of statements.
|
[Jess in Action][AskingGoodQuestions]
|
 |
david zhang
Greenhorn
Joined: Oct 12, 2003
Posts: 27
|
|
Ernest, Thanks for your advice. I will try. David
|
 |
 |
|
|
subject: atomic block of code?
|
|
|