title: How does swapcontext and getcontext work?
body: <p>I have this code below</p>
  
  <pre><code>volatile int done = 0;
  
  int main() {
  
  
  ucontext_t one;
  ucontext_t two;
  
  
  getcontext(&amp;one);
  printf("done = %d\n", done);
  if(!done) {
  done = 1;
  printf(" - gurka -\n");
  swapcontext(&amp;two, &amp;one);
  printf(" - tomat -\n");
  } else {
  printf(" - salad -\n");
  swapcontext(&amp;one, &amp;two);
  printf(" - morot -\n");
  }
  printf(" - potät -\n");
  return 0;
  }
  </code></pre>
  
  <p>When it have executed i get this below </p>
  
  <pre><code>done = 0
  - gurka -
  done = 1
  - salad -
  - tomat -
  - potät -
  </code></pre>
  
  <p>Why does it print out like this i have this function swapcontext() and in the man-pages it is written like this that it saves the context in another thread i don't understand why it writes out this?</p>