~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/thr_lock.cc

  • Committer: Brian Aker
  • Date: 2010-10-10 11:41:42 UTC
  • mfrom: (1812.3.8 refactor)
  • Revision ID: brian@tangent.org-20101010114142-qfvzs75hz6kxjdcg
Merge in shared_ptr usage.

Show diffs side-by-side

added added

removed removed

Lines of Context:
56
56
#include "drizzled/internal/my_sys.h"
57
57
#include "drizzled/internal/thread_var.h"
58
58
#include "drizzled/statistics_variables.h"
 
59
#include "drizzled/pthread_globals.h"
59
60
 
60
61
#include "drizzled/session.h"
61
62
#include "drizzled/current_session.h"
153
154
  Session *session= current_session;
154
155
  internal::st_my_thread_var *thread_var= session->getThreadVar();
155
156
 
156
 
  boost::condition_variable *cond= &thread_var->suspend;
 
157
  boost::condition_variable_any *cond= &thread_var->suspend;
157
158
  enum enum_thr_lock_result result= THR_LOCK_ABORTED;
158
159
  bool can_deadlock= test(data->owner->info->n_cursors);
159
160
 
173
174
 
174
175
  while (!thread_var->abort || in_wait_list)
175
176
  {
176
 
    boost::mutex::scoped_lock scoped(*data->lock->native_handle(), boost::adopt_lock_t());
 
177
    boost_unique_lock_t scoped(*data->lock->native_handle(), boost::adopt_lock_t());
177
178
 
178
179
    if (can_deadlock)
179
180
    {
230
231
  data->lock->unlock();
231
232
 
232
233
  /* The following must be done after unlock of lock->mutex */
233
 
  boost::mutex::scoped_lock scopedLock(thread_var->mutex);
 
234
  boost_unique_lock_t scopedLock(thread_var->mutex);
234
235
  thread_var->current_mutex= NULL;
235
236
  thread_var->current_cond= NULL;
236
237
  return(result);
407
408
 
408
409
  do
409
410
  {
410
 
    boost::condition_variable *cond= data->cond;
 
411
    boost::condition_variable_any *cond= data->cond;
411
412
    if ((int) data->type == (int) TL_READ_NO_INSERT)
412
413
    {
413
414
      if (using_concurrent_insert)
505
506
          lock->write.last= &data->next;
506
507
 
507
508
          {
508
 
            boost::condition_variable *cond= data->cond;
 
509
            boost::condition_variable_any *cond= data->cond;
509
510
            data->cond= NULL;                           /* Mark thread free */
510
511
            cond->notify_one(); /* Start waiting thred */
511
512
          }
532
533
              !lock->read_no_write_count))
533
534
    {
534
535
      do {
535
 
        boost::condition_variable *cond= data->cond;
 
536
        boost::condition_variable_any *cond= data->cond;
536
537
        if (((*data->prev)=data->next))         /* remove from wait-list */
537
538
          data->next->prev= data->prev;
538
539
        else
648
649
 
649
650
void THR_LOCK::abort_locks()
650
651
{
651
 
  boost::mutex::scoped_lock scopedLock(mutex);
 
652
  boost_unique_lock_t scopedLock(mutex);
652
653
 
653
654
  for (THR_LOCK_DATA *local_data= read_wait.data; local_data ; local_data= local_data->next)
654
655
  {
681
682
{
682
683
  bool found= false;
683
684
 
684
 
  boost::mutex::scoped_lock scopedLock(mutex);
 
685
  boost_unique_lock_t scopedLock(mutex);
685
686
  for (THR_LOCK_DATA *local_data= read_wait.data; local_data ; local_data= local_data->next)
686
687
  {
687
688
    if (local_data->owner->info->thread_id == thread_id_arg)