RFR: 7161732: Improve handling of thread_id in OSThread

David Holmes david.holmes at oracle.com
Sun May 6 05:10:55 PDT 2012


Hi Rickard,

One initial comment. Isn't this redundant:

102 #ifdef _ALLBSD_SOURCE
  103 #ifdef __APPLE__
  104   void set_thread_id(thread_t id) {
  105     _thread_id = id;
  106   }
  107 #else
  108   void set_thread_id(pthread_t id) {
  109     _thread_id = id;
  110   }
  111 #endif
  112 #else
  113   void set_thread_id(pid_t id) {
  114     _thread_id = id;
  115   }
  116 #endif

Given you have set a typedef for thread_id_t, and rely on it to avoid a 
cast on the assignment, can't you just define a single function:

void set_thread_id(thread_id_t id) {
   _thread_id = id;
}

?

David
-----

On 3/05/2012 7:39 PM, Rickard Bäckman wrote:
> Hi all,
>
> I've made a refactoring of thread_id in OSThread, which reduces the
> amount of duplicated code.
>
> Please review this change at:
> http://cr.openjdk.java.net/~rbackman/7161732/webrev/
>
> Thanks
> /R


More information about the serviceability-dev mailing list