Author: mladen.turk(a)jboss.com
Date: 2007-10-03 12:07:16 -0400 (Wed, 03 Oct 2007)
New Revision: 1080
Modified:
trunk/sight/native/include/sight_local.h
trunk/sight/native/share/no.c
Log:
Fix paralel GC
Modified: trunk/sight/native/include/sight_local.h
===================================================================
--- trunk/sight/native/include/sight_local.h 2007-10-03 08:03:29 UTC (rev 1079)
+++ trunk/sight/native/include/sight_local.h 2007-10-03 16:07:16 UTC (rev 1080)
@@ -383,7 +383,7 @@
#define SIGHT_LOCAL_TRY(N) { apr_uint32_t _SGATOM =
apr_atomic_inc32(sight_global_atomic); \
if ((N)) apr_atomic_inc32(&(N)->refcount);
\
- if ((N))
+ 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)
Modified: trunk/sight/native/share/no.c
===================================================================
--- trunk/sight/native/share/no.c 2007-10-03 08:03:29 UTC (rev 1079)
+++ trunk/sight/native/share/no.c 2007-10-03 16:07:16 UTC (rev 1080)
@@ -114,7 +114,7 @@
{
sight_object_t *no;
- UNREFERENCED_STDARGS;
+ UNREFERENCED_O;
if (!(no = (sight_object_t *)sight_calloc(_E,
sizeof(sight_object_t),
THROW_FMARK))) {
@@ -179,7 +179,7 @@
if (!no)
return;
- SIGHT_GLOBAL_TRY {
+ SIGHT_LOCAL_TRY(no) {
if (no->cb.object) {
(*_E)->DeleteGlobalRef(_E, no->cb.object);
no->cb.object = NULL;
@@ -191,7 +191,7 @@
no->cb.method = (*_E)->GetMethodID(_E, c, no->cb.name,
no->cb.msig);
DBPRINTF("NativeObject_cbset0: %s/%s", no->cb.name,
no->cb.msig);
}
- } SIGHT_GLOBAL_END();
+ } SIGHT_LOCAL_END(no);
}
SIGHT_EXPORT_DECLARE(void, NativeObject, free0)(SIGHT_STDARGS,
@@ -208,13 +208,12 @@
#endif
if (!no)
return;
- if (no->object) {
- object = (*_E)->NewLocalRef(_E, no->object);
- (*_E)->DeleteWeakGlobalRef(_E, no->object);
- no->object = object;
- }
-
SIGHT_GLOBAL_TRY {
+ if (no->object) {
+ object = (*_E)->NewLocalRef(_E, no->object);
+ (*_E)->DeleteWeakGlobalRef(_E, no->object);
+ no->object = object;
+ }
refcount = apr_atomic_read32(&no->refcount);
while (refcount) {
apr_thread_yield();
@@ -233,14 +232,12 @@
(*no->clean)(POOL_DESTROY, no);
if (no->pool)
apr_pool_destroy(no->pool);
+ if (object)
+ (*_E)->DeleteLocalRef(_E, object);
+ if (no->cb.object)
+ (*_E)->DeleteGlobalRef(_E, no->cb.object);
+ free(no);
} SIGHT_GLOBAL_END();
- if (object) {
- (*_E)->DeleteLocalRef(_E, object);
- }
- if (no->cb.object) {
- (*_E)->DeleteGlobalRef(_E, no->cb.object);
- }
- free(no);
}
SIGHT_EXPORT_DECLARE(void, NativeObject, clear0)(SIGHT_STDARGS,
Show replies by date