title: Threading issues
body: <blockquote>
    <p>getvariana: tpp.c:63: __pthread_tpp_change_priority: Assertion `new_prio == -1 || (new_prio >= __sched_fifo_min_prio &amp;&amp; new_prio &lt;= __sched_fifo_max_prio)' failed.</p>
  </blockquote>
  
  <p>Hi all,</p>
  
  <p>I am trying to re-run a program which creates 5 threads and after pthread_join(), I do a return, based on which, I re-run the entire program i.e., it is in while(1) loop.</p>
  
  <p>When I run the program for the second time, I get an error as you can see above. I am unable to trace its origin. Can anyone please explain why is this error caused ?</p>
  
  <p>FYI: I dont use any mutex locks or semaphore. I wait for the threads to join after which I re-run the entire program. Does it have anything to do with race conditions ? I am assuming, that when I wait for all the 5 threads to join, only then I can move out of the pthread</p>
  
  <pre><code>main
  {
      while(1)
      {
           test();
      }
  }//main
  
  test()
  {
      for( i = 0; i &lt; 5; i++ )
          pthread_create( &amp;th[i], NULL, tfunc, &amp;some_struct);
  
      for( i = 0; i &lt; 5, i++ )
          pthread_join( th[i], NULL);
  }
  
  void * tfunc( void * ptr )
  {
      // waiting for a callback function to set a global counter to a value
      // sleep until then
      if( g_count == value_needed )
          pthread_exit(NULL);
  }
  </code></pre>