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 cb...@apache.org on 2005/04/25 20:57:53 UTC
cvs commit: ws-axis/c/src/engine Axis.cpp
cblecken 2005/04/25 11:57:53
Modified: c/src/engine Axis.cpp
Log:
Instead of the interlocked exchange mechanism (which was not portable
from VC6 to VC7), doing it with the incremnt and decrement function.
The 2nd thread trying to initialize will spin until the first on is done.
PR:AXISCPP-629
Obtained from:Tim Bartley
Submitted by: cblecken
Revision Changes Path
1.96 +11 -11 ws-axis/c/src/engine/Axis.cpp
Index: Axis.cpp
===================================================================
RCS file: /home/cvs/ws-axis/c/src/engine/Axis.cpp,v
retrieving revision 1.95
retrieving revision 1.96
diff -u -r1.95 -r1.96
--- Axis.cpp 23 Mar 2005 15:44:58 -0000 1.95
+++ Axis.cpp 25 Apr 2005 18:57:52 -0000 1.96
@@ -294,17 +294,17 @@
#ifdef WIN32
-static volatile long g_uModuleInitializing = 0;
-static void start_initializing()
-{
- long exchange = 1;
- long comperand = 0;
- while (InterlockedCompareExchange(((void **)&g_uModuleInitializing), (void *)&exchange, (void *) &comperand));
-}
-static void done_initializing()
-{
- g_uModuleInitializing = 0;
-}
+static volatile long g_uModuleInitializing = 0;
+static void start_initializing()
+{
+ while (InterlockedIncrement((LONG*)&g_uModuleInitializing) != 1) {
+ InterlockedDecrement((LONG*)&g_uModuleInitializing);
+ }
+}
+static void done_initializing()
+{
+ InterlockedDecrement((LONG*)&g_uModuleInitializing);
+}
#else