List:Commits« Previous MessageNext Message »
From:jonas Date:August 4 2008 9:04am
Subject:bzr commit into mysql-5.1-telco-6.4 branch (jonas:2689)
View as plain text  
#At file:///home/jonas/src/telco-6.4/

 2689 jonas@stripped	2008-08-04
          ndb(mt) -
            1) Add assertion that no NdbCondition is created before NdbCondition_init
            2) Don't create condition variables (as fallback for futex) in initializer,
               but add init() method
modified:
  storage/ndb/src/common/portlib/NdbCondition.c
  storage/ndb/src/kernel/vm/mt.cpp

=== modified file 'storage/ndb/src/common/portlib/NdbCondition.c'
--- a/storage/ndb/src/common/portlib/NdbCondition.c	2008-06-09 11:57:17 +0000
+++ b/storage/ndb/src/common/portlib/NdbCondition.c	2008-08-04 09:04:33 +0000
@@ -26,6 +26,8 @@ struct NdbCondition
   pthread_cond_t cond;
 };
 
+
+static int init = 0;
 #ifdef HAVE_CLOCK_GETTIME
 static int clock_id = CLOCK_REALTIME;
 #endif
@@ -33,6 +35,7 @@ static int clock_id = CLOCK_REALTIME;
 void
 NdbCondition_Init()
 {
+  init = 1;
 #if defined HAVE_CLOCK_GETTIME && defined HAVE_PTHREAD_CONDATTR_SETCLOCK && \
     defined CLOCK_MONOTONIC
   
@@ -78,6 +81,7 @@ NdbCondition_Create(void)
   struct NdbCondition* tmpCond;
   int result;
   
+  assert(init);
   tmpCond = (struct NdbCondition*)NdbMem_Allocate(sizeof(struct NdbCondition));
   
   if (tmpCond == NULL)

=== modified file 'storage/ndb/src/kernel/vm/mt.cpp'
--- a/storage/ndb/src/kernel/vm/mt.cpp	2008-07-25 08:46:15 +0000
+++ b/storage/ndb/src/kernel/vm/mt.cpp	2008-08-04 09:04:33 +0000
@@ -119,6 +119,7 @@ struct thr_wait
     FS_SLEEPING = 1,
   };
   thr_wait() { xcng(&m_futex_state, FS_RUNNING);}
+  void init () {}
 };
 
 /**
@@ -182,6 +183,11 @@ struct thr_wait
   NdbMutex *m_mutex;
   NdbCondition *m_cond;
   thr_wait() {
+    m_mutex = 0;
+    m_cond = 0;
+  }
+
+  void init() {
     m_mutex = NdbMutex_Create();
     m_cond = NdbCondition_Create();
   }
@@ -1976,6 +1982,7 @@ update_sched_stats(thr_data *selfptr)
 static void
 init_thread(thr_data *selfptr)
 {
+  selfptr->m_waiter.init();
   selfptr->m_jam.theEmulatedJamIndex = 0;
   selfptr->m_jam.theEmulatedJamBlockNumber = 0;
   memset(selfptr->m_jam.theEmulatedJam, 0, sizeof(selfptr->m_jam.theEmulatedJam));

Thread
bzr commit into mysql-5.1-telco-6.4 branch (jonas:2689) jonas4 Aug