id | ID of the event to destroy. |
Destroy the event with the given ID. You should call this to free temporary resources associated with an event. Attempting to use the event after it has been destroyed, for example using IDeviceContext.Wait or IDeviceContext.IsCompleted will result in undefined behavior.
// Create context. using var ctx = new RadeonRaysContext(); ctx.Initialize();
// Create buffer. BufferID buffer = ctx.CreateBuffer(sizeof(int) * 8); using var array = new NativeArray<int>(8, Allocator.Persistent, NativeArrayOptions.ClearMemory);
// Write to buffer and wait for completion. EventID evt = ctx.CreateEvent(); ctx.WriteBuffer(buffer.Slice<int>(), array, evt); var flushOk = ctx.Flush(); Assert.IsTrue(flushOk); var waitOk = ctx.Wait(evt); Assert.IsTrue(waitOk);
// Cleanup. After this point, we may no longer use `evt`. ctx.DestroyEvent(evt); ctx.DestroyBuffer(buffer);
Proper usage of DestroyEvent.