1
0
mirror of https://github.com/lidgren/lidgren-network-gen3.git synced 2026-05-16 15:16:33 +09:00

Enumerated and exposed network thread name

This commit is contained in:
lidgren
2010-08-13 06:44:07 +00:00
parent 38bb13b3a7
commit cf60a5ef57
3 changed files with 31 additions and 24 deletions

View File

@@ -31,6 +31,8 @@ namespace Lidgren.Network
[DebuggerDisplay("Status={m_status}")]
public partial class NetPeer
{
private static int s_threadCount = 0;
internal const int kMinPacketHeaderSize = 2;
internal const int kMaxPacketHeaderSize = 5;
@@ -51,6 +53,11 @@ namespace Lidgren.Network
/// </summary>
public NetPeerStatus Status { get { return m_status; } }
/// <summary>
/// Name of the network thread (if NetPeer.Start has been called)
/// </summary>
public string NetworkThreadName { get { return (m_networkThread == null ? string.Empty : m_networkThread.Name); } }
/// <summary>
/// Gets a copy of the list of connections
/// </summary>
@@ -141,10 +148,10 @@ namespace Lidgren.Network
m_configuration.VerifyAndLock();
InitializeNetwork();
// start network thread
m_networkThread = new Thread(new ThreadStart(NetworkLoop));
m_networkThread.Name = "Lidgren network thread";
m_networkThread.Name = "Lidgren network thread " + Interlocked.Increment(ref s_threadCount).ToString();
m_networkThread.IsBackground = true;
m_networkThread.Start();