Hi Mladen,

On 15.12.2009 11:14, mt...@apache.org wrote:
Author: mturk
Date: Tue Dec 15 10:14:28 2009
New Revision: 890738

URL: http://svn.apache.org/viewvc?rev=890738&view=rev
Log:
Use better thread id logic. Use 4/8 byte alignment

Modified:
     tomcat/jk/trunk/native/common/jk_util.c

Modified: tomcat/jk/trunk/native/common/jk_util.c
URL: 
http://svn.apache.org/viewvc/tomcat/jk/trunk/native/common/jk_util.c?rev=890738&r1=890737&r2=890738&view=diff
==============================================================================
--- tomcat/jk/trunk/native/common/jk_util.c (original)
+++ tomcat/jk/trunk/native/common/jk_util.c Tue Dec 15 10:14:28 2009
@@ -2125,13 +2125,16 @@
      pthread_getunique_np(&(u.tid),&tid);
      return ((jk_uint32_t)(tid.intId.lo&  0xFFFFFFFF));
  #else
-    switch(sizeof(pthread_t)) {
-    case sizeof(jk_uint32_t):
-        return *(jk_uint32_t *)&u.tid;
-    case sizeof(jk_uint64_t):
-        return (*(jk_uint64_t *)&u.tid)&  0xFFFFFFFF;
-    default:
-        return 0;
+    switch (sizeof(pthread_t)) {
+        case sizeof(jk_uint32_t):
+            return ((jk_uint32_t)u.tid>>  2);
+        break;
+        case sizeof(jk_uint64_t):
+            return (jk_uint32_t)((((jk_uint64_t)u.tid)>>  3)&  0xFFFFFFFF);
+        break;
+        default:
+            return 0;
+        break;
      }
  #endif /* AS400 */
  }

Why is that better? I'm concerned, that it breaks thread id's as logged by other components. For instance on Solaris I think the thread id logged by mod_jk is the same as by httpd when using %{tid}P in the access log. On Linux there are two different thread ids, one in the type of the pid, and another one which usually produces large numbers.

What does the above change result in w.r.t. aligning our thread id with the one in Apache?

Regards,

Rainer

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to