/// <summary>
        /// Lock the move module and wait for standstill
        /// </summary>
        /// <param name="channel">Code channel acquiring the lock</param>
        /// <returns>Whether the resource could be locked</returns>
        public static Task <bool> LockMovementAndWaitForStandstill(CodeChannel channel)
        {
            QueuedLockRequest request = new QueuedLockRequest(true);

            using (_channels[channel].Lock())
            {
                _channels[channel].PendingLockRequests.Enqueue(request);
            }
            return(request.Task);
        }
        /// <summary>
        /// Unlock all resources occupied by the given channel
        /// </summary>
        /// <param name="channel">Channel holding the resources</param>
        /// <returns>Asynchronous task</returns>
        public static Task UnlockAll(CodeChannel channel)
        {
            QueuedLockRequest request = new QueuedLockRequest(false);

            using (_channels[channel].Lock())
            {
                _channels[channel].PendingLockRequests.Enqueue(request);
            }
            return(request.Task);
        }
        /// <summary>
        /// Unlock all resources occupied by the given channel
        /// </summary>
        /// <param name="channel">Channel holding the resources</param>
        /// <returns>Asynchronous task</returns>
        public static async Task UnlockAll(CodeChannel channel)
        {
            QueuedLockRequest request = new QueuedLockRequest(false);

            using (await Channels[channel].LockAsync())
            {
                Channels[channel].PendingLockRequests.Enqueue(request);
            }
            await request.Task;
        }