Commit 9fa6409f authored by SherryChaos's avatar SherryChaos

Send a message every 0.1 seconds

parent 959ac6b9
This diff is collapsed.
......@@ -25,11 +25,14 @@ namespace MDPro3
public static List<Package> packagesInRecord = new List<Package>();
private static readonly Queue<Package> messageQueue = new Queue<Package>();
static Thread senderThead;
public static void InitializeSender()
{
try
{
var senderThead = new Thread(Sender);
senderThead?.Abort();
senderThead = new Thread(Sender);
senderThead.IsBackground = true;
senderThead.Start();
}
......@@ -252,7 +255,10 @@ namespace MDPro3
lock (locker)
{
if (messageQueue.Count == 0)
{
senderThead.Join(100);
continue;
}
currentMessage = messageQueue.Dequeue();
}
try
......
......@@ -1496,6 +1496,7 @@ namespace MDPro3
psum = false;
greenBackground.gameObject.SetActive(false);
inputMode = false;
}
public void AddPackage(Package p)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment