private void InvokeInternal(Action action) { Monitor.Enter(this); try { if (_invokeActions == null) { _invokeActions = new Queue <System.Action>(); } } finally { Monitor.Exit(this); } Monitor.Enter(_invokeActions); try { if (_invokeActionMessage == 0) { _invokeActionMessage = Win32.RegisterWindowMessage(XLBOLT_INVOKE_ACTION); } _invokeActions.Enqueue(action); } finally { Monitor.Exit(_invokeActions); } if (IsMessageLoopBegin) { Win32.PostThreadMessage(_threadID, _invokeActionMessage, UIntPtr.Zero, IntPtr.Zero); } }