Skip to content

Thread safety

apleshkov edited this page Jul 30, 2018 · 3 revisions

If you use cached services and want to be sure about resolving dependencies from different threads, add the @saber.threadSafe annotation to your containers.

// @saber.container(AppContainer)
// @saber.scope(App)
// @saber.threadSafe
protocol AppContaining {}

Saber uses recursive locks to avoid freezing.

What will be done inside lock() & unlock():

  • creation and all injections
  • storing inside a container
Clone this wiki locally