[commit] r2256 - Hack-fix ODBC remote connection failure on linux by not prodding the high-pri

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[commit] r2256 - Hack-fix ODBC remote connection failure on linux by not prodding the high-pri

commits-3
 
Author: eliot
Date: 2010-08-20 11:36:50 -0700 (Fri, 20 Aug 2010)
New Revision: 2256

Modified:
   branches/Cog/platforms/Cross/vm/sq.h
   branches/Cog/platforms/Cross/vm/sqTicker.c
   branches/Cog/platforms/unix/vm/sqUnixHeartbeat.c
Log:
Hack-fix ODBC remote connection failure on linux by not prodding the high-pri
thread if there are o high-priority tickees.  More fall-out of the lack of
thread priorities on linux.


Modified: branches/Cog/platforms/Cross/vm/sq.h
===================================================================
--- branches/Cog/platforms/Cross/vm/sq.h 2010-08-19 02:43:25 UTC (rev 2255)
+++ branches/Cog/platforms/Cross/vm/sq.h 2010-08-20 18:36:50 UTC (rev 2256)
@@ -138,6 +138,9 @@
 void ioUpdateVMTimezone();
 void ioSynchronousCheckForEvents();
 void checkHighPriorityTickees(usqLong);
+# if ITIMER_HEARTBEAT /* Hack; allow heartbeat to avoid */
+extern int numAsyncTickees; /* prodHighPriorityThread unless necessary */
+# endif /* see platforms/unix/vm/sqUnixHeartbeat.c */
 void ioGetClockLogSizeUsecsIdxMsecsIdx(sqInt*,void**,sqInt*,void**,sqInt*);
 #endif
 

Modified: branches/Cog/platforms/Cross/vm/sqTicker.c
===================================================================
--- branches/Cog/platforms/Cross/vm/sqTicker.c 2010-08-19 02:43:25 UTC (rev 2255)
+++ branches/Cog/platforms/Cross/vm/sqTicker.c 2010-08-20 18:36:50 UTC (rev 2256)
@@ -137,7 +137,10 @@
  }
 }
 
-static int numAsyncTickees = 0;
+#if !ITIMER_HEARTBEAT /* Hack; allow heartbeat to avoid */
+static /* prodHighPriorityThread unless necessary */
+# endif /* see platforms/unix/vm/sqUnixHeartbeat.c */
+int numAsyncTickees = 0;
 static Tickee async[NUM_ASYNCHRONOUS_TICKEES];
 
 /* Add or remove an asynchronous tickee.  If periodms is non zero add the

Modified: branches/Cog/platforms/unix/vm/sqUnixHeartbeat.c
===================================================================
--- branches/Cog/platforms/unix/vm/sqUnixHeartbeat.c 2010-08-19 02:43:25 UTC (rev 2255)
+++ branches/Cog/platforms/unix/vm/sqUnixHeartbeat.c 2010-08-20 18:36:50 UTC (rev 2256)
@@ -309,7 +309,17 @@
  else
  heartbeats += 1;
 #if ITIMER_HEARTBEAT
- { void prodHighPriorityThread(void); prodHighPriorityThread(); }
+ /* While we use SA_RESTART to ensure system calls are restarted, this is
+ * not universally effective.  In particular, connect calls can abort if
+ * a system call is made in the signal handler, i.e. the pthread_kill in
+ * prodHighPriorityThread.  So we avoid this if possible by not prodding
+ * the high-priority thread unless there are high-priority tickees as
+ * indicated by numAsyncTickees > 0.
+ */
+ if (numAsyncTickees > 0) {
+ void prodHighPriorityThread(void);
+ prodHighPriorityThread();
+ }
 #else
  checkHighPriorityTickees(utcMicrosecondClock);
 #endif