You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by sh...@apache.org on 2009/09/28 15:40:56 UTC

svn commit: r819533 - in /webservices/axis2/trunk/c/util/src/platforms: unix/thread_unix.c windows/thread_windows.c

Author: shankar
Date: Mon Sep 28 13:40:55 2009
New Revision: 819533

URL: http://svn.apache.org/viewvc?rev=819533&view=rev
Log:
Fixing dual channel listener crash

Modified:
    webservices/axis2/trunk/c/util/src/platforms/unix/thread_unix.c
    webservices/axis2/trunk/c/util/src/platforms/windows/thread_windows.c

Modified: webservices/axis2/trunk/c/util/src/platforms/unix/thread_unix.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/util/src/platforms/unix/thread_unix.c?rev=819533&r1=819532&r2=819533&view=diff
==============================================================================
--- webservices/axis2/trunk/c/util/src/platforms/unix/thread_unix.c (original)
+++ webservices/axis2/trunk/c/util/src/platforms/unix/thread_unix.c Mon Sep 28 13:40:55 2009
@@ -155,7 +155,7 @@
     axutil_thread_t * thd,
     axutil_allocator_t * allocator)
 {
-
+    axis2_bool_t same_thread = AXIS2_TRUE;
     if(thd)
     {
         while(!thd->try_exit)
@@ -165,11 +165,20 @@
 
         if(thd->td)
         {
+            same_thread = pthread_equal(pthread_self(), thd->td);
+            if(!same_thread)
+            {
+                pthread_kill(thd->td, 0);
+                axutil_thread_join(thd);
+            }
             AXIS2_FREE(allocator, thd->td);
         }
         AXIS2_FREE(allocator, thd);
     }
-    pthread_exit(NULL);
+    if(same_thread)
+    {
+        pthread_exit(NULL);
+    }
     return AXIS2_SUCCESS;
 }
 

Modified: webservices/axis2/trunk/c/util/src/platforms/windows/thread_windows.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/util/src/platforms/windows/thread_windows.c?rev=819533&r1=819532&r2=819533&view=diff
==============================================================================
--- webservices/axis2/trunk/c/util/src/platforms/windows/thread_windows.c (original)
+++ webservices/axis2/trunk/c/util/src/platforms/windows/thread_windows.c Mon Sep 28 13:40:55 2009
@@ -138,8 +138,16 @@
     axutil_allocator_t * allocator)
 {
     axis2_status_t status = AXIS2_SUCCESS;
+
     if(thd)
     {
+        if(thd->td && (axis2_os_thread_current() != thd->td))
+        {
+            TerminateThread(thd->td, 0);
+            axutil_thread_join(thd);
+            AXIS2_FREE(allocator, thd);
+            return status;
+        }
         AXIS2_FREE(allocator, thd);
     }
     if(status)