Example #1
0
        public Event EnqueueBarrier(Event[] events)
        {
            ClHelper.ThrowNullException(Handle);

            try
            {
                unsafe
                {
                    int     num_events_in_wait_list = events == null ? 0 : events.Length;
                    IntPtr *wait_list = stackalloc IntPtr[num_events_in_wait_list];
                    for (int i = 0; i < num_events_in_wait_list; ++i)
                    {
                        wait_list[i] = events[i].Handle;
                    }
                    if (events == null)
                    {
                        wait_list = null;
                    }

                    IntPtr event_ptr = IntPtr.Zero;

                    ClHelper.GetError(Cl.EnqueueBarrierWithWaitList(
                                          Handle, (uint)num_events_in_wait_list, wait_list, &event_ptr));

                    return(new Event(event_ptr));
                }
            }
            catch (EntryPointNotFoundException)
            {
                throw ClHelper.VersionException(1, 2);
            }
        }