How is data race avoided!!

Saurabh Gadia gadia at usc.edu
Mon Jul 27 16:10:21 UTC 2015


hi,

I was going through the code in _thread_change_priority(){..}
(threadchangepriority.c) and had doubt. below is the code snippet.


  _Atomic_Fence( ATOMIC_ORDER_ACQ_REL );

  /*
   *  Do not bother recomputing all the priority related information if
   *  we are not REALLY changing priority.
   */
  if ( ( *filter )( the_thread, &new_priority, arg ) ) {
    uint32_t my_generation;

    my_generation = the_thread->priority_generation + 1;
    the_thread->current_priority = new_priority;
*    the_thread->priority_generation = my_generation;*

    ( *the_thread->Wait.operations->priority_change )(
      the_thread,
      new_priority,
      the_thread->Wait.queue
    );

how is the data race problem avoided while setting
the_thread->priority_generation?


Thanks,

Saurabh Gadia
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20150727/6b78808b/attachment-0001.html>


More information about the devel mailing list