public Event EnqueueUnmapBuffer( Buffer buffer, IntPtr pointer, Event[] events) { ClHelper.ThrowNullException(Handle); if (buffer == Buffer.Null) { throw new ArgumentNullException("buffer"); } 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.EnqueueUnmapMemObject(Handle, buffer.Handle, pointer.ToPointer(), (uint)num_events_in_wait_list, wait_list, &event_ptr)); return(new Event(event_ptr)); } }