[ruby-oci8-commit] [448] trunk/ruby-oci8: run connection-pool cleanup functions in a native thread not to block GC.
nobody at rubyforge.org
nobody at rubyforge.org
Fri Sep 30 08:11:19 EDT 2011
Revision: 448
Author: kubo
Date: 2011-09-30 08:11:16 -0400 (Fri, 30 Sep 2011)
Log Message:
-----------
run connection-pool cleanup functions in a native thread not to block GC.
use xfree() instead of free() to release memory allocated by xmalloc().
Modified Paths:
--------------
trunk/ruby-oci8/ChangeLog
trunk/ruby-oci8/ext/oci8/connection_pool.c
trunk/ruby-oci8/ext/oci8/oci8.c
Modified: trunk/ruby-oci8/ChangeLog
===================================================================
--- trunk/ruby-oci8/ChangeLog 2011-08-31 14:12:45 UTC (rev 447)
+++ trunk/ruby-oci8/ChangeLog 2011-09-30 12:11:16 UTC (rev 448)
@@ -1,3 +1,9 @@
+2011-09-30 KUBO Takehiro <kubo at jiubao.org>
+ * ext/oci8/connection_pool.c: run connection-pool cleanup functions
+ in a native thread not to block GC.
+ * ext/oci8/oci8.c: use xfree() instead of free() to release memory
+ allocated by xmalloc().
+
2011-08-31 KUBO Takehiro <kubo at jiubao.org>
* ext/oci8/env.c, ext/oci8/extconf.rb, ext/oci8/oci8.c, ext/oci8/oci8.h,
ext/oci8/oci8lib.c, ext/oci8/thread_util.c, ext/oci8/thread_util.h:
Modified: trunk/ruby-oci8/ext/oci8/connection_pool.c
===================================================================
--- trunk/ruby-oci8/ext/oci8/connection_pool.c 2011-08-31 14:12:45 UTC (rev 447)
+++ trunk/ruby-oci8/ext/oci8/connection_pool.c 2011-09-30 12:11:16 UTC (rev 448)
@@ -21,9 +21,18 @@
rb_gc_mark(cpool->pool_name);
}
+static VALUE cpool_free_thread(void *arg)
+{
+ OCIConnectionPoolDestroy((OCICPool *)arg, oci8_errhp, OCI_DEFAULT);
+ OCIHandleFree(arg, OCI_HTYPE_CPOOL);
+ return 0;
+}
+
static void oci8_cpool_free(oci8_base_t *base)
{
- OCIConnectionPoolDestroy(base->hp.poolhp, oci8_errhp, OCI_DEFAULT);
+ oci8_run_native_thread(cpool_free_thread, base->hp.poolhp);
+ base->type = 0;
+ base->hp.ptr = NULL;
}
static void oci8_cpool_init(oci8_base_t *base)
Modified: trunk/ruby-oci8/ext/oci8/oci8.c
===================================================================
--- trunk/ruby-oci8/ext/oci8/oci8.c 2011-08-31 14:12:45 UTC (rev 447)
+++ trunk/ruby-oci8/ext/oci8/oci8.c 2011-09-30 12:11:16 UTC (rev 448)
@@ -267,7 +267,7 @@
OCITransRollback(sla->svchp, errhp, OCI_DEFAULT);
rv = OCILogoff(sla->svchp, errhp);
- free(sla);
+ xfree(sla);
return (VALUE)rv;
}
@@ -325,7 +325,7 @@
if (cla->svchp != NULL) {
OCIHandleFree(cla->svchp, OCI_HTYPE_SVCCTX);
}
- free(cla);
+ xfree(cla);
return (VALUE)rv;
}
More information about the ruby-oci8-commit
mailing list