Doubtful code in rtems_region_return_segment().
osv at topconrd.ru
Fri Jan 21 17:35:43 UTC 2005
The rtems_region_return_segment() routine looks like this (CVS trunc
the_region = _Region_Get( id, &location );
status = _Region_Free_segment( the_region, segment );
* Switch from using the memory allocation mutex to using a
* dispatching disabled critical section. We have to do this
* because this thread may unblock one or more threads that were
* waiting on memory.
* NOTE: The following loop is O(n) where n is the number of
* threads whose memory request is satisfied.
1. The description of why we have to do this is unclear in the first
place, -- why unblocking of threads should be done with the allocator
unlocked? Is it strictly necessary, or is it just an optimization, or
2. If this is indeed necessary, shouldn't _Thread_Disable_dispatch be
called before _RTEMS_Unlock_allocator to avoid races? Besides,
similar code in the rtems_region_get_segment does it in reverse order
Thanks in advance for any clarification of the issue.
More information about the users