Author: mladen.turk(a)jboss.com
Date: 2007-10-03 12:47:41 -0400 (Wed, 03 Oct 2007)
New Revision: 1081
Modified:
trunk/sight/native/include/sight_local.h
Log:
Add atomics option as compile time defined
Modified: trunk/sight/native/include/sight_local.h
===================================================================
--- trunk/sight/native/include/sight_local.h 2007-10-03 16:07:16 UTC (rev 1080)
+++ trunk/sight/native/include/sight_local.h 2007-10-03 16:47:41 UTC (rev 1081)
@@ -377,19 +377,32 @@
#endif
#endif
+/* For now use APR reference counters */
+#define SIGHT_APR_REFCOUNT 1
+
+#if SIGHT_APR_REFCOUNT
#define SIGHT_GLOBAL_TRY if (apr_atomic_inc32(sight_global_atomic))
#define SIGHT_GLOBAL_END() apr_atomic_dec32(sight_global_atomic)
#define SIGHT_GLOBAL_BRK() apr_atomic_dec32(sight_global_atomic)
-
#define SIGHT_LOCAL_TRY(N) { apr_uint32_t _SGATOM =
apr_atomic_inc32(sight_global_atomic); \
if ((N)) apr_atomic_inc32(&(N)->refcount);
\
if ((N) && _SGATOM)
#define SIGHT_LOCAL_END(N) apr_atomic_dec32(&(N)->refcount); }
apr_atomic_dec32(sight_global_atomic)
#define SIGHT_LOCAL_BRK(N) apr_atomic_dec32(&(N)->refcount);
apr_atomic_dec32(sight_global_atomic)
-
#define SIGHT_LOCAL_IRQ(N) apr_atomic_read32(&(N)->interrupted)
+#else
+#define SIGHT_GLOBAL_TRY
+#define SIGHT_GLOBAL_END()
+#define SIGHT_GLOBAL_BRK()
+#define SIGHT_LOCAL_TRY(N) if ((N))
+#define SIGHT_LOCAL_END(N)
+#define SIGHT_LOCAL_BRK(N)
+#define SIGHT_LOCAL_IRQ(N)
+
+#endif /* SIGHT_APR_REFCOUNT */
+
/* Statistics counters */
extern volatile apr_uint64_t sight_cnt_native_alloc;
extern volatile apr_uint64_t sight_cnt_native_create;