~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/drizzled.cc

  • Committer: Barry.Leslie at PrimeBase
  • Date: 2010-10-20 20:41:00 UTC
  • mfrom: (1863 staging)
  • mto: This revision was merged to the branch mainline in revision 1871.
  • Revision ID: barry.leslie@primebase.com-20101020204100-oyj6p5cfssjw3p62
Merged with trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
435
435
 
436
436
  Session *tmp;
437
437
 
438
 
  LOCK_thread_count.lock(); // For unlink from list
439
 
 
440
 
  for( SessionList::iterator it= getSessionList().begin(); it != getSessionList().end(); ++it )
441
438
  {
442
 
    tmp= *it;
443
 
    tmp->killed= Session::KILL_CONNECTION;
444
 
    tmp->scheduler->killSession(tmp);
445
 
    DRIZZLE_CONNECTION_DONE(tmp->thread_id);
446
 
    tmp->lockOnSys();
 
439
    boost::mutex::scoped_lock scoped(LOCK_thread_count);
 
440
    for( SessionList::iterator it= getSessionList().begin(); it != getSessionList().end(); ++it )
 
441
    {
 
442
      tmp= *it;
 
443
      tmp->killed= Session::KILL_CONNECTION;
 
444
      tmp->scheduler->killSession(tmp);
 
445
      DRIZZLE_CONNECTION_DONE(tmp->thread_id);
 
446
      tmp->lockOnSys();
 
447
    }
447
448
  }
448
 
  LOCK_thread_count.unlock(); // For unlink from list
449
449
 
450
450
  if (connection_count)
451
451
    sleep(2);                                   // Give threads time to die
457
457
  */
458
458
  for (;;)
459
459
  {
460
 
    LOCK_thread_count.lock(); // For unlink from list
 
460
    boost::mutex::scoped_lock scoped(LOCK_thread_count);
461
461
    if (getSessionList().empty())
462
462
    {
463
 
      LOCK_thread_count.unlock();
464
463
      break;
465
464
    }
466
465
    tmp= getSessionList().front();
467
466
    /* Close before unlock, avoiding crash. See LP bug#436685 */
468
467
    tmp->client->close();
469
 
    LOCK_thread_count.unlock();
470
468
  }
471
469
}
472
470
 
626
624
 
627
625
  session->cleanup();
628
626
 
629
 
  LOCK_thread_count.lock();
 
627
  boost::mutex::scoped_lock scoped(LOCK_thread_count);
630
628
  session->lockForDelete();
631
629
 
632
630
  getSessionList().erase(remove(getSessionList().begin(),
638
636
  }
639
637
 
640
638
  delete session;
641
 
  LOCK_thread_count.unlock();
642
639
}
643
640
 
644
641