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