6 * Convert an ACE_thread_t to an integer in a way that doesn't rely
7 * heavily on platform-specific configuration.
9 * @author Ossama Othman
14 template<typename thread_id_type
, typename ace_thread_id_type
>
15 struct ACE_thread_t_to_integer_i
17 thread_id_type
operator() (ace_thread_id_type tid
)
19 // We assume sizeof(thread_id_type) >= sizeof(ace_thread_id_type).
20 return (thread_id_type
) (tid
);
24 template<typename thread_id_type
, typename ace_thread_id_type
>
25 struct ACE_thread_t_to_integer_i
<thread_id_type
, ace_thread_id_type
*>
27 thread_id_type
operator() (ace_thread_id_type
* tid
)
29 // ACE_thread_t is a pointer. Cast to an intermediate integer
30 // type large enough to hold a pointer.
31 intptr_t const tmp
= reinterpret_cast<intptr_t> (tid
);
33 // We assume sizeof(thread_id_type) >= sizeof(ace_thread_id_type).
34 return (thread_id_type
) tmp
;
38 template<typename thread_id_type
>
40 ACE_thread_t_to_integer (ACE_thread_t tid
)
42 return ACE_thread_t_to_integer_i
<thread_id_type
, ACE_thread_t
>() (tid
);