summaryrefslogtreecommitdiff
path: root/ACE/ace/Log_Msg.cpp
diff options
context:
space:
mode:
authormhengstmengel <mhengstmengel@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2010-08-24 14:16:37 +0000
committermhengstmengel <mhengstmengel@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2010-08-24 14:16:37 +0000
commit0e9570b08174b8fa9dd665a7ec278cbab6f4a506 (patch)
tree21cd6fc7251526aa79b7068400ffba62cf17c428 /ACE/ace/Log_Msg.cpp
parent47dea9c1956f186ce4de98fea2f3ffb2553a293a (diff)
downloadATCD-0e9570b08174b8fa9dd665a7ec278cbab6f4a506.tar.gz
Tue Aug 24 14:15:45 UTC 2010 Marijke Hengstmengel <mhengstmengel@remedy.nl>
* ace/Log_Msg.cpp * ace/Log_Msg.h * tests/Log_Msg_Test.cpp Revert changes for logging thread id as argument.
Diffstat (limited to 'ACE/ace/Log_Msg.cpp')
-rw-r--r--ACE/ace/Log_Msg.cpp110
1 files changed, 52 insertions, 58 deletions
diff --git a/ACE/ace/Log_Msg.cpp b/ACE/ace/Log_Msg.cpp
index 9669710ca50..8276c5c7df4 100644
--- a/ACE/ace/Log_Msg.cpp
+++ b/ACE/ace/Log_Msg.cpp
@@ -920,7 +920,6 @@ ACE_Log_Msg::open (const ACE_TCHAR *prog_name,
* 'T': print timestamp in hour:minute:sec:usec format.
* 'D': print timestamp in month/day/year hour:minute:sec:usec format.
* 't': print thread id (1 if single-threaded)
- * '#t': print thread id argument
* 'u': print as unsigned int
* 'x': print as a hex number
* 'X': print as a hex number
@@ -1718,68 +1717,63 @@ ACE_Log_Msg::log (const ACE_TCHAR *format_str,
}
case 't': // Format thread id.
- {
- // Did we find the flag indicating a thread value argument
- ACE_hthread_t thr_id;
- if (format[1] == ACE_TEXT('#'))
- {
- thr_id = va_arg (argp, ACE_hthread_t);
- }
- else
- {
-#if defined (DIGITAL_UNIX) && defined (ACE_HAS_THREADS)
- thr_id =
- static_cast<ACE_hthread_t> (pthread_getselfseq_np ());
-#else
- ACE_Thread::self (thr_id);
-#endif
- }
-
#if defined (ACE_WIN32)
- ACE_OS::strcpy (fp, ACE_TEXT ("u"));
- if (can_check)
- this_len = ACE_OS::snprintf
- (bp, bspace, format,
- static_cast<unsigned> (thr_id));
- else
- this_len = ACE_OS::sprintf (bp, format,
- static_cast<unsigned> (thr_id));
+ ACE_OS::strcpy (fp, ACE_TEXT ("u"));
+ if (can_check)
+ this_len = ACE_OS::snprintf
+ (bp, bspace, format,
+ static_cast<unsigned> (ACE_Thread::self ()));
+ else
+ this_len =
+ ACE_OS::sprintf (bp,
+ format,
+ static_cast <unsigned> (ACE_Thread::self ()));
#elif defined (DIGITAL_UNIX)
- ACE_OS::strcpy (fp, ACE_TEXT ("u"));
- if (can_check)
- this_len = ACE_OS::snprintf (bp, bspace, format,
- static_cast<unsigned> (thr_id));
- else
- this_len = ACE_OS::sprintf (bp, format,
- static_cast<unsigned> (thr_id));
-#else
-#if defined (ACE_MVS) || defined (ACE_TANDEM_T1248_PTHREADS)
- // MVS's pthread_t is a struct... yuck. So use the ACE 5.0
- // code for it.
- ACE_OS::strcpy (fp, ACE_TEXT ("u"));
- if (can_check)
- this_len = ACE_OS::snprintf (bp, bspace, format, thr_id);
- else
- this_len = ACE_OS::sprintf (bp, format, thr_id);
+ ACE_OS::strcpy (fp, ACE_TEXT ("u"));
+ {
+ int id =
+# if defined (ACE_HAS_THREADS)
+ pthread_getselfseq_np ();
+# else
+ ACE_Thread::self ();
+# endif /* ACE_HAS_THREADS */
+
+ if (can_check)
+ this_len = ACE_OS::snprintf (bp, bspace, format, id);
+ else
+ this_len = ACE_OS::sprintf (bp, format, id);
+ }
#else
- // Yes, this is an ugly C-style cast, but the correct
- // C++ cast is different depending on whether the t_id
- // is an integral type or a pointer type. FreeBSD uses
- // a pointer type, but doesn't have a _np function to
- // get an integral type, like the OSes above.
- ACE_OS::strcpy (fp, ACE_TEXT ("lu"));
- if (can_check)
- this_len = ACE_OS::snprintf (bp, bspace, format,
- static_cast<unsigned long> (thr_id));
- else
- this_len = ACE_OS::sprintf (bp, format,
- static_cast<unsigned long> (thr_id));
-#endif /* ACE_MWS || ACE_TANDEM_T1248_PTHREADS */
+ ACE_hthread_t t_id;
+ ACE_Thread::self (t_id);
+
+# if defined (ACE_MVS) || defined (ACE_TANDEM_T1248_PTHREADS)
+ // MVS's pthread_t is a struct... yuck. So use the ACE 5.0
+ // code for it.
+ ACE_OS::strcpy (fp, ACE_TEXT ("u"));
+ if (can_check)
+ this_len = ACE_OS::snprintf (bp, bspace, format, t_id);
+ else
+ this_len = ACE_OS::sprintf (bp, format, t_id);
+# else
+ // Yes, this is an ugly C-style cast, but the correct
+ // C++ cast is different depending on whether the t_id
+ // is an integral type or a pointer type. FreeBSD uses
+ // a pointer type, but doesn't have a _np function to
+ // get an integral type, like the OSes above.
+ ACE_OS::strcpy (fp, ACE_TEXT ("lu"));
+ if (can_check)
+ this_len = ACE_OS::snprintf
+ (bp, bspace, format, (unsigned long)t_id);
+ else
+ this_len = ACE_OS::sprintf
+ (bp, format, (unsigned long)t_id);
+# endif /* ACE_MWS || ACE_TANDEM_T1248_PTHREADS */
#endif /* ACE_WIN32 */
- ACE_UPDATE_COUNT (bspace, this_len);
- break;
- }
+ ACE_UPDATE_COUNT (bspace, this_len);
+ break;
+
case 's': // String
{
#if !defined (ACE_WIN32) && defined (ACE_USES_WCHAR)