class FileScheduler

Locks access to files on the same drive, allowing only one file to be read at a time, per drive.

This prevents multiple threads accessing multiple files on the same drive at once, ruining performance on mechanical drives.

Public

Methods

staticLock

static void Lock(const Path &path)

Locks access and doesn't allow other threads to get past this point until access is unlocked.

Any scheduled file access should happen past this point.

staticUnlock

static void Unlock(const Path &path)

Unlocks access and allows another thread to lock file access.

Must be provided with the same file path as lock().

staticGetLock

static ::Lock GetLock(const Path &path)

Returns a lock object that immediately locks access (same as lock()), and then calls unlock() when it goes out of scope.