Beispiel #1
0
        /// <summary>
        /// Enqueues a marker command which waits for either a list of events to complete,
        /// or all previously enqueued commands to complete.
        /// </summary>
        /// <remarks>
        /// Enqueues a marker command which waits for all events in
        /// <paramref name="eventWaitList"/> to complete, or if
        /// <paramref name="eventWaitList"/> is empty it waits for all previously enqueued
        /// commands to complete before it completes. This command returns an event which
        /// can be waited on, i.e. this event can be waited on to ensure that all events
        /// either in <paramref name="eventWaitList"/> or all previously enqueued commands,
        /// queued before this command, have completed.
        /// </remarks>
        /// <param name="eventWaitList">The events that need to be complete before this
        /// command is executed. If the list is null or empty, this command waits until
        /// all previous enqueued commands have completed.</param>
        /// <returns>Returns an event object that identifies this particular command.</returns>
        public Event EnqueueMarker(params Event[] eventWaitList)
        {
            EventSafeHandle[] eventHandles = null;
            if (eventWaitList != null)
            {
                eventHandles = Array.ConvertAll(eventWaitList, @event => @event.Handle);
            }

            EventSafeHandle handle = UnsafeNativeMethods.EnqueueMarkerWithWaitList(Handle, eventHandles);

            return(new Event(handle));
        }