Ejemplo n.º 1
0
        public Event EnqueueTask(Kernel kernel, Event[] events)
        {
            ClHelper.ThrowNullException(Handle);

            if (kernel == Kernel.Null)
            {
                throw new ArgumentNullException("kernel");
            }

            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.EnqueueTask(Handle, kernel.Handle,
                                                 (uint)num_events_in_wait_list, wait_list, &event_ptr));

                return(new Event(event_ptr));
            }
        }