title: ucontext and thread local storage
body: <p>The platform I am asking about is linux.  Thread local storage I am talking about is <code>pthread_xxx</code> or <code>__thread</code> in gcc.</p>
  
  <p>I want to use ucontext stuff, i.e., makecontext, swapcontext, etc. in my program.  So my question is, how does it work with thread local storage?  More specifically, if I switch to another fiber using swapcontext or setcontext, does the thread local storage change as well, or is thread local storage not a part of context?</p>
  
  <p>Another question: if TLS will be changed by <code>setcontext</code>/<code>swapcontext</code>, then is there anything that will stick to thread, no matter how I change the context?  On the other hand, if TLS will stick to context, then is there anything that will stick to thread and is not changed by setcontext/swapcontext?</p>
  
  <p>According to <a href="http://en.wikipedia.org/wiki/Fiber_%28computer_science%29" rel="nofollow">http://en.wikipedia.org/wiki/Fiber_(computer_science)</a>, the Windows platform does have thread-local storage and fiber-local storage. </p>