diff options
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | ChangeLogs/ChangeLog-03c | 2 | ||||
-rw-r--r-- | THANKS | 1 | ||||
-rw-r--r-- | ace/OS_NS_Thread.cpp | 40 | ||||
-rw-r--r-- | ace/OS_NS_Thread.h | 4 |
5 files changed, 32 insertions, 23 deletions
diff --git a/ChangeLog b/ChangeLog index d366d522ba1..e755f97b19f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +Sun Jul 4 20:30:56 2004 Douglas C. Schmidt <schmidt@cs.wustl.edu> + + * ace/OS_NS_Thread.cpp: There was some weirdness in the + to_string() method, which should have been using the local data + members for the thread id and thread handle, but instead was + calling the Os functions directly... Thanks to Michael Hollins + <michael.hollins@silverbrookresearch.com> for reporting this. + Sat Jul 3 06:46:06 2004 J.T. Conklin <jtc@acorntoolworks.com> * ace/config-openbsd.h: diff --git a/ChangeLogs/ChangeLog-03c b/ChangeLogs/ChangeLog-03c index 1302ecb11c2..bbd6f2714d6 100644 --- a/ChangeLogs/ChangeLog-03c +++ b/ChangeLogs/ChangeLog-03c @@ -11816,7 +11816,7 @@ Mon Jul 21 01:56:44 2003 Yamuna Krishnamurthy <yamuna@oomworks.com> Added method getmacaddress () to get the mac address of the host for generating UUIDs - Added to_string () method to ACE_Thread_ID class to create a + Added to_string() method to ACE_Thread_ID class to create a string representation of ACE_Thread_ID. * ace/config-win32-common.h: @@ -1901,6 +1901,7 @@ Randy Secrest <secrest at ieee dot org> Patrice Marques <simu dot dcnruelle at wanadoo dot fr> Stanislaw Trytek <tryteks at pit dot edu dot pl> Mattias Nilsson <mattias dot o dot nilsson at ericsson dot com> +Michael Hollins <michael dot hollins at silverbrookresearch dot com> I would particularly like to thank Paul Stephenson, who worked with me at Ericsson in the early 1990's. Paul devised the recursive Makefile diff --git a/ace/OS_NS_Thread.cpp b/ace/OS_NS_Thread.cpp index a72f93291b4..eb093f30e13 100644 --- a/ace/OS_NS_Thread.cpp +++ b/ace/OS_NS_Thread.cpp @@ -121,9 +121,8 @@ ACE_Thread_ID::handle (ACE_hthread_t thread_handle) } void -ACE_Thread_ID::to_string (char* thr_id) +ACE_Thread_ID::to_string (char *thr_string) { - char format[128]; // Converted format string char *fp; // Current format pointer fp = format; @@ -131,10 +130,10 @@ ACE_Thread_ID::to_string (char* thr_id) #if defined (ACE_WIN32) ACE_OS::strcpy (fp, "u"); - ACE_OS::sprintf (thr_id, + ACE_OS::sprintf (thr_string, format, - ACE_static_cast(unsigned, - ACE_OS::thr_self ())); + ACE_static_cast (unsigned, + thread_id_)); #elif defined (ACE_AIX_VERS) && (ACE_AIX_VERS <= 402) // AIX's pthread_t (ACE_hthread_t) is a pointer, and it's // a little ugly to send that through a %u format. So, @@ -147,40 +146,41 @@ ACE_Thread_ID::to_string (char* thr_id) // this would have on that. // -Steve Huston, 19-Aug-97 ACE_OS::strcpy (fp, "u"); - ACE_OS::sprintf (thr_id, format, thread_self()); + ACE_OS::sprintf (thr_string, format, thread_id_); #elif defined (DIGITAL_UNIX) ACE_OS::strcpy (fp, "u"); - ACE_OS::sprintf (thr_id, format, + ACE_OS::sprintf (thr_string, format, # if defined (ACE_HAS_THREADS) - pthread_getselfseq_np () + thread_id_ # else - ACE_Thread::self () + thread_id_ # endif /* ACE_HAS_THREADS */ ); #else - ACE_hthread_t t_id; - ACE_OS::thr_self (t_id); # if defined (ACE_HAS_PTHREADS_DRAFT4) && defined (HPUX_10) ACE_OS::strcpy (fp, "u"); // HP-UX 10.x DCE's thread ID is a pointer. Grab the // more meaningful, readable, thread ID. This will match // the one seen in the debugger as well. - ACE_OS::sprintf (thr_id, format, - pthread_getunique_np(&t_id)); + ACE_OS::sprintf (thr_string, format, + pthread_getunique_np(&thread_handle_)); # elif 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, "u"); - ACE_OS::sprintf (thr_id, format, t_id); + ACE_OS::sprintf (thr_string, format, thread_handle_); # 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. + // 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, "lu"); - ACE_OS::sprintf (thr_id, format, (unsigned long)t_id); + ACE_OS::sprintf (thr_string, + format, + (unsigned long) thread_handle_); # endif /* ACE_HAS_PTHREADS_DRAFT4 && HPUX_10 */ #endif /* ACE_WIN32 */ diff --git a/ace/OS_NS_Thread.h b/ace/OS_NS_Thread.h index da0f0b9ae3b..55496e2df09 100644 --- a/ace/OS_NS_Thread.h +++ b/ace/OS_NS_Thread.h @@ -716,8 +716,8 @@ public: ACE_hthread_t handle (void); void handle (ACE_hthread_t); - void to_string (char*); - + // Create a string representation of the thread id. + void to_string (char *thr_string); // != Comparison operator. bool operator== (const ACE_Thread_ID &) const; |