threadSafeStateContainer

Wraps any StateContainer with additional thread safety guarantees.

While ImmutableStateContainer is already thread-safe, this wrapper can be used for additional guarantees or to make custom StateContainer implementations thread-safe.

Example usage:

val container = stateContainer(MyState())
val threadSafeContainer = threadSafeStateContainer(container)

Return

A thread-safe wrapper around the given container

Parameters

T

The type of state being managed

container

The StateContainer to wrap