48
48
#include "drizzled/gettext.h"
49
49
#include "drizzled/configmake.h"
50
50
#include "drizzled/session.h"
51
#include "drizzled/session/cache.h"
52
51
#include "drizzled/internal/my_sys.h"
53
52
#include "drizzled/unireg.h"
54
53
#include "drizzled/drizzled.h"
62
61
#include "drizzled/replication_services.h"
63
62
#include "drizzled/transaction_services.h"
65
#include "drizzled/util/backtrace.h"
67
64
using namespace drizzled;
68
65
using namespace std;
69
66
namespace fs=boost::filesystem;
333
328
TransactionServices &transaction_services= TransactionServices::singleton();
335
330
/* Send server startup event */
331
if ((session= new Session(plugin::Listen::getNullClient())))
339
if ((session= new Session(plugin::Listen::getNullClient())))
341
currentSession().release();
342
currentSession().reset(session);
343
transaction_services.sendStartupEvent(session);
333
transaction_services.sendStartupEvent(session);
334
session->lockForDelete();
351
341
should be shutdown. */
352
342
while ((client= plugin::Listen::getClient()) != NULL)
354
Session::shared_ptr session(new Session(client));
344
if (!(session= new Session(client)))
362
350
/* If we error on creation we drop the connection and delete the session. */
363
if (Session::schedule(session))
351
if (session->schedule())
364
352
Session::unlink(session);
367
355
/* Send server shutdown event */
371
if ((session= new Session(plugin::Listen::getNullClient())))
373
currentSession().release();
374
currentSession().reset(session);
375
transaction_services.sendShutdownEvent(session);
381
boost::mutex::scoped_lock scopedLock(session::Cache::singleton().mutex());
382
select_thread_in_use= false; // For close_connections
356
if ((session= new Session(plugin::Listen::getNullClient())))
358
transaction_services.sendShutdownEvent(session);
359
session->lockForDelete();
363
LOCK_thread_count.lock();
364
select_thread_in_use=0; // For close_connections
365
LOCK_thread_count.unlock();
384
366
COND_thread_count.notify_all();
386
368
/* Wait until cleanup is done */
388
boost::mutex::scoped_lock scopedLock(session::Cache::singleton().mutex());
389
while (not ready_to_exit)
370
boost::mutex::scoped_lock scopedLock(LOCK_thread_count);
371
while (!ready_to_exit)
390
372
COND_server_end.wait(scopedLock);