Files
VoxelEngine/World/Streaming/IJobExecutor.cs

16 lines
506 B
C#

namespace VoxelEngine.World.Streaming;
public interface IJobExecutor
{
void Submit(Action work);
}
public sealed class ThreadPoolJobExecutor : IJobExecutor
{
// Fire-and-forget: the Task is intentionally discarded. The caller's `work`
// delegate MUST catch its own exceptions and report them via a dedicated
// channel (e.g. ChunkJobResult.Error in the streaming pipeline). Unhandled
// exceptions here are silently lost.
public void Submit(Action work) => _ = Task.Run(work);
}