~kalebral-deactivatedaccount/drizzle/621304

« back to all changes in this revision

Viewing changes to drizzled/session.cc

  • Committer: lbieber
  • Date: 2010-09-24 17:14:34 UTC
  • mfrom: (1791.2.1 build)
  • Revision ID: lbieber@orisndriz08-20100924171434-yejt9e2n459hafpa
Merge Brian - Latest work on boost, also PBXT set to be linux only.

Show diffs side-by-side

added added

removed removed

Lines of Context:
300
300
    return;
301
301
 
302
302
  setAbort(true);
303
 
  pthread_mutex_lock(&mysys_var->mutex);
 
303
  boost::mutex::scoped_lock scopedLock(mysys_var->mutex);
304
304
  if (mysys_var->current_cond)
305
305
  {
306
 
    pthread_mutex_lock(mysys_var->current_mutex);
307
 
    pthread_cond_broadcast(mysys_var->current_cond);
308
 
    pthread_mutex_unlock(mysys_var->current_mutex);
 
306
    mysys_var->current_mutex->lock();
 
307
    pthread_cond_broadcast(mysys_var->current_cond->native_handle());
 
308
    mysys_var->current_mutex->unlock();
309
309
  }
310
 
  pthread_mutex_unlock(&mysys_var->mutex);
311
310
}
312
311
 
313
312
void Session::pop_internal_handler()
416
415
  }
417
416
  if (mysys_var)
418
417
  {
419
 
    pthread_mutex_lock(&mysys_var->mutex);
 
418
    boost::mutex::scoped_lock scopedLock(mysys_var->mutex);
420
419
    /*
 
420
      "
421
421
      This broadcast could be up in the air if the victim thread
422
422
      exits the cond in the time between read and broadcast, but that is
423
423
      ok since all we want to do is to make the victim thread get out
438
438
    */
439
439
    if (mysys_var->current_cond && mysys_var->current_mutex)
440
440
    {
441
 
      pthread_mutex_lock(mysys_var->current_mutex);
442
 
      pthread_cond_broadcast(mysys_var->current_cond);
443
 
      pthread_mutex_unlock(mysys_var->current_mutex);
 
441
      mysys_var->current_mutex->lock();
 
442
      pthread_cond_broadcast(mysys_var->current_cond->native_handle());
 
443
      mysys_var->current_mutex->unlock();
444
444
    }
445
 
    pthread_mutex_unlock(&mysys_var->mutex);
446
445
  }
447
446
}
448
447
 
579
578
{
580
579
  const char* old_msg = get_proc_info();
581
580
  safe_mutex_assert_owner(mutex);
582
 
  mysys_var->current_mutex = mutex.native_handle();
583
 
  mysys_var->current_cond = cond.native_handle();
 
581
  mysys_var->current_mutex = &mutex;
 
582
  mysys_var->current_cond = &cond;
584
583
  this->set_proc_info(msg);
585
584
  return old_msg;
586
585
}
593
592
    locked (if that would not be the case, you'll get a deadlock if someone
594
593
    does a Session::awake() on you).
595
594
  */
596
 
  pthread_mutex_unlock(mysys_var->current_mutex);
597
 
  pthread_mutex_lock(&mysys_var->mutex);
 
595
  mysys_var->current_mutex->unlock();
 
596
  boost::mutex::scoped_lock scopedLock(mysys_var->mutex);
598
597
  mysys_var->current_mutex = 0;
599
598
  mysys_var->current_cond = 0;
600
599
  this->set_proc_info(old_msg);
601
 
  pthread_mutex_unlock(&mysys_var->mutex);
602
600
}
603
601
 
604
602
bool Session::authenticate()