[RTEMS Project] #2423: rtems_iterate_over_all_threads lacks user callback private pointer pass through

RTEMS trac trac at rtems.org
Tue Sep 22 00:12:13 UTC 2015


#2423: rtems_iterate_over_all_threads lacks user callback private pointer pass
through
-------------------------+-------------------------------------------------
 Reporter:  johill       |      Owner:
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  4.11.1
Component:  General      |    Version:  4.10
 Severity:  normal       |   Keywords:  rtems_iterate_over_all_threads
                         |  callback private
-------------------------+-------------------------------------------------
 Typically when designing an API that calls a user callback there is a user
 private "void *" pointer transparently passed through to the user callback
 so that the user can access his private state inside of his callback
 without being forced to employ a global variable. A global variable doesnt
 work very well if there are multiple objects instances created each of
 them using the same method with rtems_iterate_over_all_threads. This type
 of "void *" private pointer is of course a standard approach allowing the
 users callback to behave much the same way as a virtual method in C++, but
 nevertheless retaining a compatible C based API.

 An enhanced version of the API might look like this.

 void rtems_iterate_over_all_threads_xxx(
 rtems_per_thread_routine routine, void * const pUserPrivatePassThrogh
 );

 typedef void (*rtems_per_thread_routine_xxx)(
 Thread_Control *the_thread, void * const pUserPrivatePassThrogh
 );

 The pUserPrivatePassThrogh is not used by the library; it is retained for
 the duration of the rtems_iterate_over_all_threads_xxx function only so
 that it can be passed through to the user's callback.

 thanks for your consideration of this matter

--
Ticket URL: <http://devel.rtems.org/ticket/2423>
RTEMS Project <http://www.rtems.org/>
RTEMS Project


More information about the bugs mailing list