~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/thr_lock.cc

  • Committer: Monty Taylor
  • Date: 2011-02-13 17:26:39 UTC
  • mfrom: (2157.2.2 give-in-to-pkg-config)
  • mto: This revision was merged to the branch mainline in revision 2166.
  • Revision ID: mordred@inaugust.com-20110213172639-nhy7i72sfhoq13ms
Merged in pkg-config fixes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
52
52
 
53
53
*/
54
54
 
55
 
#include <config.h>
56
 
#include <drizzled/internal/my_sys.h>
57
 
#include <drizzled/internal/thread_var.h>
58
 
#include <drizzled/statistics_variables.h>
59
 
#include <drizzled/pthread_globals.h>
 
55
#include "config.h"
 
56
#include "drizzled/internal/my_sys.h"
 
57
#include "drizzled/internal/thread_var.h"
 
58
#include "drizzled/statistics_variables.h"
 
59
#include "drizzled/pthread_globals.h"
60
60
 
61
 
#include <drizzled/session.h>
 
61
#include "drizzled/session.h"
62
62
 
63
63
#include "thr_lock.h"
64
 
#include <drizzled/internal/m_string.h>
 
64
#include "drizzled/internal/m_string.h"
65
65
#include <errno.h>
66
66
#include <list>
67
67
 
91
91
 
92
92
uint64_t max_write_lock_count= UINT64_MAX;
93
93
 
 
94
void thr_multi_unlock(THR_LOCK_DATA **data,uint32_t count);
 
95
 
94
96
/*
95
97
** For the future (now the thread specific cond is alloced by my_pthread.c)
96
98
*/
170
172
 
171
173
  while (not thread_var->abort)
172
174
  {
173
 
    boost::mutex::scoped_lock scoped(*data->lock->native_handle(), boost::adopt_lock_t());
 
175
    boost_unique_lock_t scoped(*data->lock->native_handle(), boost::adopt_lock_t());
174
176
 
175
177
    if (can_deadlock)
176
178
    {
227
229
  data->lock->unlock();
228
230
 
229
231
  /* The following must be done after unlock of lock->mutex */
230
 
  boost::mutex::scoped_lock scopedLock(thread_var->mutex);
 
232
  boost_unique_lock_t scopedLock(thread_var->mutex);
231
233
  thread_var->current_mutex= NULL;
232
234
  thread_var->current_cond= NULL;
233
235
  return(result);
346
348
    {
347
349
      if (!lock->write_wait.data)
348
350
      {                                         /* no scheduled write locks */
 
351
        bool concurrent_insert= 0;
 
352
        if (lock_type == TL_WRITE_CONCURRENT_INSERT)
 
353
        {
 
354
          concurrent_insert= 1;
 
355
        }
 
356
 
349
357
        if (!lock->read.data ||
350
358
            (lock_type <= TL_WRITE_CONCURRENT_INSERT &&
351
359
             ((lock_type != TL_WRITE_CONCURRENT_INSERT &&
598
606
      return(result);
599
607
    }
600
608
  }
 
609
  /*
 
610
    Ensure that all get_locks() have the same status
 
611
    If we lock the same table multiple times, we must use the same
 
612
    status_param!
 
613
  */
 
614
#if !defined(DONT_USE_RW_LOCKS)
 
615
  if (count > 1)
 
616
  {
 
617
    THR_LOCK_DATA *last_lock= end[-1];
 
618
    pos=end-1;
 
619
    do
 
620
    {
 
621
      pos--;
 
622
      last_lock=(*pos);
 
623
    } while (pos != data);
 
624
  }
 
625
#endif
601
626
  return(THR_LOCK_SUCCESS);
602
627
}
603
628
 
633
658
 
634
659
void THR_LOCK::abort_locks()
635
660
{
636
 
  boost::mutex::scoped_lock scopedLock(mutex);
 
661
  boost_unique_lock_t scopedLock(mutex);
637
662
 
638
663
  for (THR_LOCK_DATA *local_data= read_wait.data; local_data ; local_data= local_data->next)
639
664
  {
666
691
{
667
692
  bool found= false;
668
693
 
669
 
  boost::mutex::scoped_lock scopedLock(mutex);
 
694
  boost_unique_lock_t scopedLock(mutex);
670
695
  for (THR_LOCK_DATA *local_data= read_wait.data; local_data ; local_data= local_data->next)
671
696
  {
672
697
    if (local_data->owner->info->thread_id == thread_id_arg)