mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-13 03:09:04 +01:00
Give names to threads for debugging purposes.
This commit is contained in:
@@ -38,7 +38,7 @@ class AndroidExecutorImpl implements AndroidExecutor {
|
||||
|
||||
private void startIfNecessary() {
|
||||
if(started.getAndSet(true)) return;
|
||||
new Thread(loop).start();
|
||||
new Thread(loop, "AndroidExecutor").start();
|
||||
try {
|
||||
startLatch.await();
|
||||
} catch(InterruptedException e) {
|
||||
|
||||
@@ -44,6 +44,7 @@ abstract class Connector extends Thread {
|
||||
Connector(CryptoComponent crypto, ReaderFactory readerFactory,
|
||||
WriterFactory writerFactory, ConnectorGroup group,
|
||||
DuplexPlugin plugin, PseudoRandom random) {
|
||||
super("Connector");
|
||||
this.crypto = crypto;
|
||||
this.readerFactory = readerFactory;
|
||||
this.writerFactory = writerFactory;
|
||||
|
||||
@@ -52,6 +52,7 @@ class ConnectorGroup extends Thread implements InvitationTask {
|
||||
ReaderFactory readerFactory, WriterFactory writerFactory,
|
||||
PluginManager pluginManager, int handle, int localInvitationCode,
|
||||
int remoteInvitationCode) {
|
||||
super("ConnectorGroup");
|
||||
this.invitationManager = invitationManager;
|
||||
this.crypto = crypto;
|
||||
this.readerFactory = readerFactory;
|
||||
|
||||
@@ -24,7 +24,7 @@ class ShutdownManagerImpl implements ShutdownManager {
|
||||
}
|
||||
|
||||
protected Thread createThread(Runnable r) {
|
||||
return new Thread(r);
|
||||
return new Thread(r, "ShutdownManager");
|
||||
}
|
||||
|
||||
public synchronized boolean removeShutdownHook(int handle) {
|
||||
|
||||
@@ -90,6 +90,10 @@ class WindowsShutdownManagerImpl extends ShutdownManagerImpl {
|
||||
|
||||
private class EventLoop extends Thread {
|
||||
|
||||
private EventLoop() {
|
||||
super("EventLoop");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
@@ -140,7 +144,7 @@ class WindowsShutdownManagerImpl extends ShutdownManagerImpl {
|
||||
private final AtomicBoolean called = new AtomicBoolean(false);
|
||||
|
||||
private StartOnce(Runnable r) {
|
||||
super(r);
|
||||
super(r, "ShutdownManager");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -34,7 +34,7 @@ class PollerImpl implements Poller, Runnable {
|
||||
|
||||
public synchronized void start(Collection<Plugin> plugins) {
|
||||
for(Plugin plugin : plugins) schedule(plugin);
|
||||
new Thread(this).start();
|
||||
new Thread(this, "Poller").start();
|
||||
}
|
||||
|
||||
private synchronized void schedule(Plugin plugin) {
|
||||
|
||||
@@ -66,13 +66,13 @@ class DuplexConnectionFactoryImpl implements DuplexConnectionFactory {
|
||||
conn.write();
|
||||
}
|
||||
};
|
||||
new Thread(write).start();
|
||||
new Thread(write, "DuplexConnectionWriter").start();
|
||||
Runnable read = new Runnable() {
|
||||
public void run() {
|
||||
conn.read();
|
||||
}
|
||||
};
|
||||
new Thread(read).start();
|
||||
new Thread(read, "DuplexConnectionReader").start();
|
||||
}
|
||||
|
||||
public void createOutgoingConnection(ContactId c, TransportId t,
|
||||
@@ -92,12 +92,12 @@ class DuplexConnectionFactoryImpl implements DuplexConnectionFactory {
|
||||
conn.write();
|
||||
}
|
||||
};
|
||||
new Thread(write).start();
|
||||
new Thread(write, "DuplexConnectionWriter").start();
|
||||
Runnable read = new Runnable() {
|
||||
public void run() {
|
||||
conn.read();
|
||||
}
|
||||
};
|
||||
new Thread(read).start();
|
||||
new Thread(read, "DuplexConnectionReader").start();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ class SimplexConnectionFactoryImpl implements SimplexConnectionFactory {
|
||||
conn.read();
|
||||
}
|
||||
};
|
||||
new Thread(read).start();
|
||||
new Thread(read, "SimplexConnectionReader").start();
|
||||
}
|
||||
|
||||
public void createOutgoingConnection(ContactId c, TransportId t,
|
||||
@@ -84,6 +84,6 @@ class SimplexConnectionFactoryImpl implements SimplexConnectionFactory {
|
||||
conn.write();
|
||||
}
|
||||
};
|
||||
new Thread(write).start();
|
||||
new Thread(write, "SimplexConnectionWriter").start();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user