Input System  v0.1
ISX.LowLevel.InputEventBuffer Struct Reference

A buffer containing InputEvents. More...

Public Member Functions

bool Write (InputEventPtr eventPtr)
 Copy the given event data to the event buffer. More...
 

Detailed Description

A buffer containing InputEvents.

Stored in unmanaged memory. Safe to pass to jobs.

Event buffers can be used either to simply hold N events of maximum size M or they can be used to incrementally write events to. In the latter case, an event buffer functions like a ring buffer which, when running out of space, starts overwriting older events.

Member Function Documentation

◆ Write()

bool ISX.LowLevel.InputEventBuffer.Write ( InputEventPtr  eventPtr)

Copy the given event data to the event buffer.

The copying is thread-safe such the event may be overwritten concurrently by another thread in which case the write will fail and not add data to the buffer. This, however, relies on two invariants in order to work: overwriting has to overwrite the header of the event with another header ..... this won't be thread-safe; we may see partial writes

Note that this is not thread-safe in the way that it would allow concurrent writes by multiple threads.

Parameters
eventPtr