~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/session.cc

  • Committer: Brian Aker
  • Date: 2010-09-22 22:25:29 UTC
  • mto: (1791.1.1 drizzle)
  • mto: This revision was merged to the branch mainline in revision 1792.
  • Revision ID: brian@tangent.org-20100922222529-geo4wggmu5ntqa5k
Current boost work (more conversion).

Show diffs side-by-side

added added

removed removed

Lines of Context:
299
299
    return;
300
300
 
301
301
  setAbort(true);
302
 
  pthread_mutex_lock(&mysys_var->mutex);
 
302
  boost::mutex::scoped_lock scopedLock(mysys_var->mutex);
303
303
  if (mysys_var->current_cond)
304
304
  {
305
 
    pthread_mutex_lock(mysys_var->current_mutex);
306
 
    pthread_cond_broadcast(mysys_var->current_cond);
307
 
    pthread_mutex_unlock(mysys_var->current_mutex);
 
305
    mysys_var->current_mutex->lock();
 
306
    pthread_cond_broadcast(mysys_var->current_cond->native_handle());
 
307
    mysys_var->current_mutex->unlock();
308
308
  }
309
 
  pthread_mutex_unlock(&mysys_var->mutex);
310
309
}
311
310
 
312
311
void Session::pop_internal_handler()
409
408
  }
410
409
  if (mysys_var)
411
410
  {
412
 
    pthread_mutex_lock(&mysys_var->mutex);
 
411
    boost::mutex::scoped_lock scopedLock(mysys_var->mutex);
413
412
    /*
 
413
      "
414
414
      This broadcast could be up in the air if the victim thread
415
415
      exits the cond in the time between read and broadcast, but that is
416
416
      ok since all we want to do is to make the victim thread get out
431
431
    */
432
432
    if (mysys_var->current_cond && mysys_var->current_mutex)
433
433
    {
434
 
      pthread_mutex_lock(mysys_var->current_mutex);
435
 
      pthread_cond_broadcast(mysys_var->current_cond);
436
 
      pthread_mutex_unlock(mysys_var->current_mutex);
 
434
      mysys_var->current_mutex->lock();
 
435
      pthread_cond_broadcast(mysys_var->current_cond->native_handle());
 
436
      mysys_var->current_mutex->unlock();
437
437
    }
438
 
    pthread_mutex_unlock(&mysys_var->mutex);
439
438
  }
440
439
}
441
440
 
570
569
{
571
570
  const char* old_msg = get_proc_info();
572
571
  safe_mutex_assert_owner(mutex);
573
 
  mysys_var->current_mutex = mutex.native_handle();
574
 
  mysys_var->current_cond = cond.native_handle();
 
572
  mysys_var->current_mutex = &mutex;
 
573
  mysys_var->current_cond = &cond;
575
574
  this->set_proc_info(msg);
576
575
  return old_msg;
577
576
}
584
583
    locked (if that would not be the case, you'll get a deadlock if someone
585
584
    does a Session::awake() on you).
586
585
  */
587
 
  pthread_mutex_unlock(mysys_var->current_mutex);
588
 
  pthread_mutex_lock(&mysys_var->mutex);
 
586
  mysys_var->current_mutex->unlock();
 
587
  boost::mutex::scoped_lock scopedLock(mysys_var->mutex);
589
588
  mysys_var->current_mutex = 0;
590
589
  mysys_var->current_cond = 0;
591
590
  this->set_proc_info(old_msg);
592
 
  pthread_mutex_unlock(&mysys_var->mutex);
593
591
}
594
592
 
595
593
bool Session::authenticate()