HISE Docs

ThreadsSafeStorage

Create a ThreadSafeStorage with Engine.createThreadSafeStorage() .

const var ThreadSafeStorage = Engine.createThreadSafeStorage();


Class methods

clear

Clears the data. If another thread tries to read the value, it will block until that operation is done.

ThreadSafeStorage.clear()



load

Loads the data. If the data is currently being written, this will lock and wait until the write operation is completed.

ThreadSafeStorage.load()



store

Writes the given data to the internal storage. If another thread tries to read the value, it will block until that operation is done.

ThreadSafeStorage.store(var dataToStore)



storeWithCopy

Creates a copy of the data and writes the copy to the data storage. If another thread tries to read the value, it will block until that operation is done.

ThreadSafeStorage.storeWithCopy(var dataToStore)



tryLoad

Loads the data if the lock can be gained or returns a given default value if the data is currently being written.

ThreadSafeStorage.tryLoad(var returnValueIfLocked)