MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:msvensson Date:February 14 2006 10:35am
Subject:bk commit into 5.0 tree (msvensson:1.2039) BUG#16333
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of msvensson. When msvensson does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.2039 06/02/14 11:34:46 msvensson@neptunus.(none) +1 -0
  Bug#16333 Assertion failure in lock.cc in the sysbench test
   - Set the value of mp->thread before mp->count to avoid race condition.

  mysys/thr_mutex.c
    1.28 06/02/14 11:34:30 msvensson@neptunus.(none) +5 -4
    Set mp->thread before mp->count is changed. 
    Since mp->count is used in the macros 'safe_mutex_assert_not_owner' and 
    'safe_mutex_assert_owner' as an inidicator wheter to look at the mp->thread
    variable or not. This means that when mp->count is changed, the mp->thread
    should akready be set to the owning thread.
    Also set mp->thread to 0 when unlocking the mutex.

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	msvensson
# Host:	neptunus.(none)
# Root:	/home/msvensson/mysql/bug16333/my50-bug16333

--- 1.27/mysys/thr_mutex.c	2005-10-11 23:58:17 +02:00
+++ 1.28/mysys/thr_mutex.c	2006-02-14 11:34:30 +01:00
@@ -103,7 +103,7 @@
     fflush(stderr);
     abort();
   }
-    
+
   pthread_mutex_lock(&mp->global);
   if (mp->count > 0 && pthread_equal(pthread_self(),mp->thread))
   {
@@ -121,6 +121,7 @@
     fflush(stderr);
     abort();
   }
+  mp->thread= pthread_self();
   if (mp->count++)
   {
     fprintf(stderr,"safe_mutex: Error in thread libray: Got mutex at %s, \
@@ -128,7 +129,6 @@
     fflush(stderr);
     abort();
   }
-  mp->thread=pthread_self();
   mp->file= file;
   mp->line=line;
   pthread_mutex_unlock(&mp->global);
@@ -154,6 +154,7 @@
     fflush(stderr);
     abort();
   }
+  mp->thread= 0;
   mp->count--;
 #ifdef __WIN__
   pthread_mutex_unlock(&mp->mutex);
@@ -207,6 +208,7 @@
     fflush(stderr);
     abort();
   }
+  mp->thread=pthread_self();
   if (mp->count++)
   {
     fprintf(stderr,
@@ -215,7 +217,6 @@
     fflush(stderr);
     abort();
   }
-  mp->thread=pthread_self();
   mp->file= file;
   mp->line=line;
   pthread_mutex_unlock(&mp->global);
@@ -245,6 +246,7 @@
   }
 #endif
   pthread_mutex_lock(&mp->global);
+  mp->thread=pthread_self();
   if (mp->count++)
   {
     fprintf(stderr,
@@ -253,7 +255,6 @@
     fflush(stderr);
     abort();
   }
-  mp->thread=pthread_self();
   mp->file= file;
   mp->line=line;
   pthread_mutex_unlock(&mp->global);
Thread
bk commit into 5.0 tree (msvensson:1.2039) BUG#16333msvensson14 Feb