[ruby-oci8-commit] [451] trunk/ruby-oci8: delete subversion keywords.

nobody at rubyforge.org nobody at rubyforge.org
Sat Oct 1 00:20:02 EDT 2011


Revision: 451
Author:   kubo
Date:     2011-10-01 00:20:02 -0400 (Sat, 01 Oct 2011)

Log Message:
-----------
delete subversion keywords.
use thread-local errhp not only at ruby 1.9 and rubinius,
but also ruby 1.8 configured with --enable-pthread.

Modified Paths:
--------------
    trunk/ruby-oci8/ChangeLog
    trunk/ruby-oci8/ext/oci8/attr.c
    trunk/ruby-oci8/ext/oci8/env.c
    trunk/ruby-oci8/ext/oci8/oci8.h
    trunk/ruby-oci8/ext/oci8/ocidatetime.c
    trunk/ruby-oci8/ext/oci8/oradate.c
    trunk/ruby-oci8/ext/oci8/thread_util.c
    trunk/ruby-oci8/ext/oci8/thread_util.h

Modified: trunk/ruby-oci8/ChangeLog
===================================================================
--- trunk/ruby-oci8/ChangeLog	2011-10-01 03:14:45 UTC (rev 450)
+++ trunk/ruby-oci8/ChangeLog	2011-10-01 04:20:02 UTC (rev 451)
@@ -1,4 +1,11 @@
 2011-10-01  KUBO Takehiro  <kubo at jiubao.org>
+	* ext/oci8/attr.c, ext/oci8/ocidatetime.c, ext/oci8/oradate.c: delete
+	    subversion keywords.
+	* ext/oci8/env.c, ext/oci8/oci8.h, ext/oci8/thread_util.c,
+	  ext/oci8/thread_util.h: use thread-local errhp not only at ruby 1.9
+	    and rubinius, but also ruby 1.8 configured with --enable-pthread.
+
+2011-10-01  KUBO Takehiro  <kubo at jiubao.org>
 	* ext/oci8/bind.c, ext/oci8/connection_pool.c, ext/oci8/lob.c,
 	  ext/oci8/metadata.c, ext/oci8/object.c, ext/oci8/oci8.c, ext/oci8/oci8.h,
 	  ext/oci8/oci8lib.c, ext/oci8/ocidatetime.c, ext/oci8/ocihandle.c,

Modified: trunk/ruby-oci8/ext/oci8/attr.c
===================================================================
--- trunk/ruby-oci8/ext/oci8/attr.c	2011-10-01 03:14:45 UTC (rev 450)
+++ trunk/ruby-oci8/ext/oci8/attr.c	2011-10-01 04:20:02 UTC (rev 451)
@@ -2,9 +2,6 @@
 /*
  * attr.c
  *
- * $Author$
- * $Date$
- *
  * Copyright (C) 2002-2007 KUBO Takehiro <kubo at jiubao.org>
  */
 #include "oci8.h"

Modified: trunk/ruby-oci8/ext/oci8/env.c
===================================================================
--- trunk/ruby-oci8/ext/oci8/env.c	2011-10-01 03:14:45 UTC (rev 450)
+++ trunk/ruby-oci8/ext/oci8/env.c	2011-10-01 04:20:02 UTC (rev 451)
@@ -27,9 +27,9 @@
     return oci8_global_envhp;
 }
 
-#ifdef HAVE_RB_THREAD_BLOCKING_REGION
+#ifdef USE_THREAD_LOCAL_ERRHP
 /*
- * oci8_errhp is a thread local object in ruby 1.9.
+ * Setup thread-local oci8_errhp.
  */
 
 oci8_tls_key_t oci8_tls_key; /* native thread key */
@@ -89,7 +89,7 @@
 }
 #else
 /*
- * oci8_errhp is global in ruby 1.8.
+ * oci8_errhp is global in ruby 1.8 configured without --enable-pthread on Unix.
  */
 OCIError *oci8_global_errhp;
 
@@ -106,7 +106,7 @@
 
 void Init_oci8_env(void)
 {
-#ifdef HAVE_RB_THREAD_BLOCKING_REGION
+#ifdef USE_THREAD_LOCAL_ERRHP
     int error;
 #endif
 
@@ -156,8 +156,7 @@
         }
     }
 
-#ifdef HAVE_RB_THREAD_BLOCKING_REGION
-/* ruby 1.9 */
+#ifdef USE_THREAD_LOCAL_ERRHP
 #if defined(_WIN32)
     if (!dllmain_is_called) {
         /* sanity check */

Modified: trunk/ruby-oci8/ext/oci8/oci8.h
===================================================================
--- trunk/ruby-oci8/ext/oci8/oci8.h	2011-10-01 03:14:45 UTC (rev 450)
+++ trunk/ruby-oci8/ext/oci8/oci8.h	2011-10-01 04:20:02 UTC (rev 451)
@@ -157,6 +157,14 @@
 #endif
 #endif
 
+#if defined(HAVE_NATIVETHREAD) || defined(HAVE_RB_THREAD_BLOCKING_REGION)
+/*
+ * oci8_errhp is a thread local object in ruby 1.9, rubinius
+ * and ruby 1.8 configured with --enable-pthread.
+ */
+#define USE_THREAD_LOCAL_ERRHP 1
+#endif
+
 /* macros depends on the compiler.
  *  LIKELY(x)      hint for the compiler that 'x' is 1(TRUE) in many cases.
  *  UNLIKELY(x)    hint for the compiler that 'x' is 0(FALSE) in many cases.
@@ -189,8 +197,8 @@
  *    set a value to the key.
  *
  */
-#ifdef HAVE_RB_THREAD_BLOCKING_REGION
-/* ruby 1.9 */
+#ifdef USE_THREAD_LOCAL_ERRHP
+/* rubies with native-thread support. */
 #if defined(_WIN32)
 #include <windows.h>
 #define oci8_tls_key_t           DWORD
@@ -384,7 +392,7 @@
  *   extern OCIError *oci8_errhp;
  */
 #define oci8_envhp (LIKELY(oci8_global_envhp != NULL) ? oci8_global_envhp : oci8_make_envhp())
-#ifdef HAVE_RB_THREAD_BLOCKING_REGION
+#ifdef USE_THREAD_LOCAL_ERRHP
 #define oci8_errhp oci8_get_errhp()
 #else
 #define oci8_errhp (LIKELY(oci8_global_errhp != NULL) ? oci8_global_errhp : oci8_make_errhp())
@@ -394,7 +402,7 @@
 extern ub4 oci8_env_mode;
 extern OCIEnv *oci8_global_envhp;
 OCIEnv *oci8_make_envhp(void);
-#ifdef HAVE_RB_THREAD_BLOCKING_REGION
+#ifdef USE_THREAD_LOCAL_ERRHP
 extern oci8_tls_key_t oci8_tls_key; /* native thread key */
 OCIError *oci8_make_errhp(void);
 

Modified: trunk/ruby-oci8/ext/oci8/ocidatetime.c
===================================================================
--- trunk/ruby-oci8/ext/oci8/ocidatetime.c	2011-10-01 03:14:45 UTC (rev 450)
+++ trunk/ruby-oci8/ext/oci8/ocidatetime.c	2011-10-01 04:20:02 UTC (rev 451)
@@ -2,9 +2,6 @@
 /*
  *  ocidatetime.c
  *
- * $Author$
- * $Date$
- *
  * Copyright (C) 2005-2008 KUBO Takehiro <kubo at jiubao.org>
  *
  */

Modified: trunk/ruby-oci8/ext/oci8/oradate.c
===================================================================
--- trunk/ruby-oci8/ext/oci8/oradate.c	2011-10-01 03:14:45 UTC (rev 450)
+++ trunk/ruby-oci8/ext/oci8/oradate.c	2011-10-01 04:20:02 UTC (rev 451)
@@ -2,9 +2,6 @@
 /*
  *  oradate.c
  *
- * $Author$
- * $Date$
- *
  * Copyright (C) 2002-2008 KUBO Takehiro <kubo at jiubao.org>
  *
  * date and time between 4712 B.C. and 9999 A.D.

Modified: trunk/ruby-oci8/ext/oci8/thread_util.c
===================================================================
--- trunk/ruby-oci8/ext/oci8/thread_util.c	2011-10-01 03:14:45 UTC (rev 450)
+++ trunk/ruby-oci8/ext/oci8/thread_util.c	2011-10-01 04:20:02 UTC (rev 451)
@@ -7,6 +7,8 @@
 #include "oci8.h"
 #include <errno.h>
 
+#ifdef USE_THREAD_LOCAL_ERRHP
+
 #ifndef WIN32
 #include <pthread.h>
 static pthread_attr_t detached_thread_attr;
@@ -51,7 +53,7 @@
     return 0;
 }
 
-#else
+#else /* WIN32 */
 
 static void *adapter(void *arg)
 {
@@ -78,4 +80,6 @@
     }
     return rv;
 }
-#endif
+#endif /* WIN32 */
+
+#endif /* USE_THREAD_LOCAL_ERRHP */

Modified: trunk/ruby-oci8/ext/oci8/thread_util.h
===================================================================
--- trunk/ruby-oci8/ext/oci8/thread_util.h	2011-10-01 03:14:45 UTC (rev 450)
+++ trunk/ruby-oci8/ext/oci8/thread_util.h	2011-10-01 04:20:02 UTC (rev 451)
@@ -4,7 +4,7 @@
  *
  * Copyright (C) 2011 KUBO Takehiro <kubo at jiubao.org>
  */
-#ifndef NATIVE_THREAD_H
+#ifdef USE_THREAD_LOCAL_ERRHP
 
 /*
  * Prepare to execute thread-related functions.
@@ -18,4 +18,13 @@
  */
 int oci8_run_native_thread(rb_blocking_function_t func, void *arg);
 
+#else
+
+/*
+ * For ruby 1.8 configured without --enable-pthread on Unix.
+ */
+
+#define Init_oci8_thread_util() do {} while (0)
+#define oci8_run_native_thread(func, arg) ((func)(arg), 0)
+
 #endif




More information about the ruby-oci8-commit mailing list