diff --git a/Runtime/Scripts/OscServer.cs b/Runtime/Scripts/OscServer.cs index cba77dc..b9c1ea9 100644 --- a/Runtime/Scripts/OscServer.cs +++ b/Runtime/Scripts/OscServer.cs @@ -25,8 +25,9 @@ public sealed unsafe class OscServer : IDisposable GCHandle m_BufferHandle; byte* m_BufferPtr; - Action[] m_MainThreadQueue = new Action[16]; + Action[] m_MainThreadQueue = new Action[mainThreadQueueSize]; int m_MainThreadCount; + private const int mainThreadQueueSize = 16; readonly Dictionary m_ByteLengthToStringBuffer = new Dictionary(); @@ -111,6 +112,13 @@ public static bool Remove(int port) } return false; } + + /// Clear the MainThreadQueue of an OSC Server + public void ClearQueue() + { + m_MainThreadCount = 0; + m_MainThreadQueue = new Action[mainThreadQueueSize]; + } /// /// Register a single background thread method for an OSC address