/// <summary> /// A synchronization point that enqueues a barrier operation. /// </summary> /// <remarks> /// Enqueues a barrier 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 blocks command execution, /// that is, any commands enqueued after it do not execute until 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 the <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 EnqueueBarrier(params Event[] eventWaitList) { EventSafeHandle[] eventHandles = null; if (eventWaitList != null) { eventHandles = Array.ConvertAll(eventWaitList, @event => @event.Handle); } EventSafeHandle handle = UnsafeNativeMethods.EnqueueBarrierWithWaitList(Handle, eventHandles); return(new Event(handle)); }