#At file:///home/jonas/src/telco-7.0/ based on revid:jonas@stripped
4383 Jonas Oreland 2011-05-16
ndb - add new function "SimulatedBlock::assertOwnThread" that can be used to
check that thread calling this function is "owner" of this block
modified:
storage/ndb/src/kernel/vm/SimulatedBlock.hpp
storage/ndb/src/kernel/vm/mt.cpp
storage/ndb/src/kernel/vm/mt.hpp
=== modified file 'storage/ndb/src/kernel/vm/SimulatedBlock.hpp'
--- a/storage/ndb/src/kernel/vm/SimulatedBlock.hpp 2011-01-30 20:56:00 +0000
+++ b/storage/ndb/src/kernel/vm/SimulatedBlock.hpp 2011-05-16 12:23:18 +0000
@@ -188,6 +188,15 @@ public:
static bool isNdbMtLqh() { return globalData.isNdbMtLqh; }
static Uint32 getLqhWorkers() { return globalData.ndbMtLqhWorkers; }
+ /**
+ * Assert that thread calling this function is "owner" of block instance
+ */
+#ifdef VM_TRACE
+ void assertOwnThread();
+#else
+ void assertOwnThread(){ }
+#endif
+
/*
* Instance key (1-4) is used only when sending a signal. Receiver
* maps it to actual instance (0, if receiver is not MT LQH).
=== modified file 'storage/ndb/src/kernel/vm/mt.cpp'
--- a/storage/ndb/src/kernel/vm/mt.cpp 2011-04-20 05:46:35 +0000
+++ b/storage/ndb/src/kernel/vm/mt.cpp 2011-05-16 12:23:18 +0000
@@ -4170,6 +4170,22 @@ mt_wakeup(class SimulatedBlock* block)
wakeup(&thrptr->m_waiter);
}
+#ifdef VM_TRACE
+void
+mt_assert_own_thread(SimulatedBlock* block)
+{
+ Uint32 thr_no = block->getThreadId();
+ thr_data *thrptr = g_thr_repository.m_thread + thr_no;
+
+ if (unlikely(pthread_equal(thrptr->m_thr_id, pthread_self()) == 0))
+ {
+ fprintf(stderr, "mt_assert_own_thread() - assertion-failure\n");
+ fflush(stderr);
+ abort();
+ }
+}
+#endif
+
/**
* Global data
*/
=== modified file 'storage/ndb/src/kernel/vm/mt.hpp'
--- a/storage/ndb/src/kernel/vm/mt.hpp 2011-02-02 00:40:07 +0000
+++ b/storage/ndb/src/kernel/vm/mt.hpp 2011-05-16 12:23:18 +0000
@@ -74,4 +74,11 @@ Uint32 mt_get_thread_references_for_bloc
*/
void mt_wakeup(class SimulatedBlock*);
+#ifdef VM_TRACE
+/**
+ * Assert that thread calling this function is "owner" of block instance
+ */
+void mt_assert_own_thread(class SimulatedBlock*);
+#endif
+
#endif
Attachment: [text/bzr-bundle] bzr/jonas@mysql.com-20110516122318-0cfirj1f426j2w0t.bundle
| Thread |
|---|
| • bzr commit into mysql-5.1-telco-7.0 branch (jonas:4383) | Jonas Oreland | 16 May |