title: How to use code that relies on ThreadLocal with Kotlin coroutines
body: <p>Some JVM frameworks use <code>ThreadLocal</code> to store the call context of a application, like the <a href="https://logback.qos.ch/manual/mdc.html" rel="noreferrer">SLF4j MDC</a>, transaction managers, security managers, and others.</p>
  
  <p>However, Kotlin coroutines are dispatched on different threads, so how it can be made to work? </p>
  
  <p>(The question is inspired by <a href="https://github.com/Kotlin/kotlinx.coroutines/issues/119" rel="noreferrer">GitHub issue</a>)</p>