mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-21 17:59:34 +00:00
Fixed some potentially serious thread cancellation issues. jrg
This commit is contained in:
parent
622ab05cdd
commit
cf1e06ffe2
@ -34,7 +34,7 @@ import grendel.util.Constants;
|
||||
import java.io.InputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.SequenceInputStream;
|
||||
import java.io.StringBufferInputStream;
|
||||
import java.io.StringReader;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.Date;
|
||||
import java.util.Enumeration;
|
||||
|
@ -51,7 +51,7 @@ import grendel.util.Constants;
|
||||
*/
|
||||
public class NewsRC {
|
||||
|
||||
static final boolean DEBUG = true;
|
||||
static final boolean DEBUG = false;
|
||||
|
||||
protected File file = null; // disk file; might not exist, but never null.
|
||||
|
||||
|
@ -39,7 +39,7 @@ import grendel.util.Constants;
|
||||
|
||||
class ParseBerkeleyFolderAndExpunge extends ParseBerkeleyFolder {
|
||||
|
||||
private static final boolean DEBUG = true;
|
||||
private static final boolean DEBUG = false;
|
||||
|
||||
protected RandomAccessFile in = null;
|
||||
protected RandomAccessFile out = null;
|
||||
|
@ -59,7 +59,7 @@ import javax.mail.event.StoreEvent;
|
||||
import grendel.util.Constants;
|
||||
|
||||
public class PopStore extends Store {
|
||||
static final boolean DEBUG = true;
|
||||
static final boolean DEBUG = false;
|
||||
static void Spew(String s) {
|
||||
if (DEBUG) System.out.println("PopStore: " + s);
|
||||
}
|
||||
|
@ -390,7 +390,7 @@ public class UnixDotLock {
|
||||
if (debug) System.err.println("KILLING " + lock_heartbeat_thread);
|
||||
Thread h = lock_heartbeat_thread;
|
||||
lock_heartbeat_thread = null;
|
||||
h.stop();
|
||||
h.interrupt();
|
||||
try {
|
||||
h.join();
|
||||
} catch (InterruptedException e) {
|
||||
@ -416,7 +416,7 @@ public class UnixDotLock {
|
||||
public static final void main(String arg[])
|
||||
throws SecurityException, IOException, InterruptedException {
|
||||
|
||||
System.runFinalizersOnExit(true);
|
||||
// System.runFinalizersOnExit(true);
|
||||
|
||||
File file1 = new File("/tmp/a");
|
||||
File file2 = new File("/tmp/b");
|
||||
|
@ -247,7 +247,6 @@ public class FolderPanel extends GeneralPanel {
|
||||
|
||||
public FolderPanel() {
|
||||
JScrollPane scrollPane = new JScrollPane();
|
||||
//scrollPane.setBorder(BorderUIResource.getLoweredBevelBorderUIResource());
|
||||
scrollPane.setBorder(BorderFactory.createLoweredBevelBorder());
|
||||
Util.RegisterScrollingKeys(scrollPane);
|
||||
|
||||
@ -389,7 +388,13 @@ public class FolderPanel extends GeneralPanel {
|
||||
|
||||
public synchronized void setFolder(Folder aFolder) {
|
||||
if (fFolderLoadThread != null) {
|
||||
fFolderLoadThread.stop();
|
||||
fFolderLoadThread.interrupt();
|
||||
try {
|
||||
fFolderLoadThread.join();
|
||||
}
|
||||
catch ( InterruptedException ie ) {
|
||||
// ignore
|
||||
}
|
||||
if (fListeners != null) {
|
||||
fListeners.folderLoaded(new ChangeEvent(fPanel));
|
||||
fListeners.folderStatus(new StatusEvent(fPanel,
|
||||
|
@ -37,10 +37,11 @@ public class Animation extends Component implements Runnable
|
||||
Thread fThread;
|
||||
Icon fGlyphs[];
|
||||
int fCurrent = 0;
|
||||
boolean runAnimation = true;
|
||||
|
||||
public void run()
|
||||
{
|
||||
while (true)
|
||||
while (runAnimation)
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -58,7 +59,7 @@ public class Animation extends Component implements Runnable
|
||||
}
|
||||
catch (InterruptedException e)
|
||||
{
|
||||
fThread.stop();
|
||||
runAnimation = false;
|
||||
fThread = null;
|
||||
}
|
||||
}
|
||||
@ -112,7 +113,13 @@ public class Animation extends Component implements Runnable
|
||||
public synchronized void start()
|
||||
{
|
||||
if (fThread != null) {
|
||||
fThread.stop();
|
||||
fThread.interrupt( );
|
||||
try {
|
||||
fThread.join( );
|
||||
}
|
||||
catch ( InterruptedException ie ) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
fThread = new Thread(this, "Animation");
|
||||
fThread.start();
|
||||
@ -121,7 +128,13 @@ public class Animation extends Component implements Runnable
|
||||
public synchronized void stop()
|
||||
{
|
||||
if (fThread != null) {
|
||||
fThread.stop();
|
||||
fThread.interrupt( );
|
||||
try {
|
||||
fThread.join( );
|
||||
}
|
||||
catch ( InterruptedException ie ) {
|
||||
// ignore
|
||||
}
|
||||
fThread = null;
|
||||
}
|
||||
fCurrent = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user