Skip to content

Commit

Permalink
Merge pull request #777 from laurynas-biveinis/bug1609422-5.6
Browse files Browse the repository at this point in the history
Bug1609422 5.6
  • Loading branch information
laurynas-biveinis committed Aug 4, 2016
2 parents 6bfea86 + b5998c3 commit 951851a
Showing 1 changed file with 19 additions and 6 deletions.
25 changes: 19 additions & 6 deletions unittest/gunit/mysys_lf-t.cc
Expand Up @@ -48,7 +48,11 @@ pthread_handler_t test_lf_pinbox(void *arg)
int m= *(int *)arg;
LF_PINS *pins;

if (with_my_thread_init)
// Save a local copy of with_my_thread_init to avoid a race with the main
// thread changing it
int do_my_thread_init= with_my_thread_init;

if (do_my_thread_init)
my_thread_init();

pins= lf_pinbox_get_pins(&lf_allocator.pinbox);
Expand All @@ -63,7 +67,7 @@ pthread_handler_t test_lf_pinbox(void *arg)
if (!--running_threads) mysql_cond_signal(&cond);
mysql_mutex_unlock(&mutex);

if (with_my_thread_init)
if (do_my_thread_init)
my_thread_end();

return 0;
Expand All @@ -84,7 +88,11 @@ pthread_handler_t test_lf_alloc(void *arg)
int32 x,y= 0;
LF_PINS *pins;

if (with_my_thread_init)
// Save a local copy of with_my_thread_init to avoid a race with the main
// thread changing it
int do_my_thread_init= with_my_thread_init;

if (do_my_thread_init)
my_thread_init();

pins= lf_alloc_get_pins(&lf_allocator);
Expand Down Expand Up @@ -117,7 +125,7 @@ pthread_handler_t test_lf_alloc(void *arg)
if (!--running_threads) mysql_cond_signal(&cond);
mysql_mutex_unlock(&mutex);

if (with_my_thread_init)
if (do_my_thread_init)
my_thread_end();
return 0;
}
Expand All @@ -129,7 +137,11 @@ pthread_handler_t test_lf_hash(void *arg)
int32 x,y,z,sum= 0, ins= 0;
LF_PINS *pins;

if (with_my_thread_init)
// Save a local copy of with_my_thread_init to avoid a race with the main
// thread changing it
int do_my_thread_init= with_my_thread_init;

if (do_my_thread_init)
my_thread_init();

pins= lf_hash_get_pins(&lf_hash);
Expand Down Expand Up @@ -167,7 +179,8 @@ pthread_handler_t test_lf_hash(void *arg)
}
if (!--running_threads) mysql_cond_signal(&cond);
mysql_mutex_unlock(&mutex);
if (with_my_thread_init)

if (do_my_thread_init)
my_thread_end();
return 0;
}
Expand Down

0 comments on commit 951851a

Please sign in to comment.