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 #if defined (ACE_OPENVMS) && (!defined (__INITIAL_POINTER_SIZE) || (__INITIAL_POINTER_SIZE < 64))
32 int const tmp
= reinterpret_cast<int> (tid
);
34 intptr_t const tmp
= reinterpret_cast<intptr_t> (tid
);
37 // We assume sizeof(thread_id_type) >= sizeof(ace_thread_id_type).
38 return (thread_id_type
) tmp
;
42 template<typename thread_id_type
>
44 ACE_thread_t_to_integer (ACE_thread_t tid
)
46 return ACE_thread_t_to_integer_i
<thread_id_type
, ACE_thread_t
>() (tid
);