~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/main.cc

  • Committer: Monty Taylor
  • Date: 2010-10-21 23:10:12 UTC
  • mto: (1879.1.2 build)
  • mto: This revision was merged to the branch mainline in revision 1880.
  • Revision ID: mordred@inaugust.com-20101021231012-uhsebiqo23xi0ygy
Updated AUTHORS list with everyone from bzr logs.

Show diffs side-by-side

added added

removed removed

Lines of Context:
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"
64
63
 
65
 
#include "drizzled/util/backtrace.h"
66
 
 
67
64
using namespace drizzled;
68
65
using namespace std;
69
66
namespace fs=boost::filesystem;
205
202
  (void)filename;
206
203
  (void)line;
207
204
  (void)message;
208
 
  std::cerr << "\n";
209
 
  drizzled::util::custom_backtrace();
210
 
  std::cerr << "\n";
211
205
  switch(level)
212
206
  {
213
207
  case google::protobuf::LOGLEVEL_INFO:
233
227
 
234
228
  module::Registry &modules= module::Registry::singleton();
235
229
  plugin::Client *client;
 
230
  Session *session;
236
231
 
237
232
  MY_INIT(argv[0]);             // init my_sys library & pthreads
238
233
  /* nothing should come before this line ^^^ */
333
328
  TransactionServices &transaction_services= TransactionServices::singleton();
334
329
 
335
330
  /* Send server startup event */
 
331
  if ((session= new Session(plugin::Listen::getNullClient())))
336
332
  {
337
 
    Session *session;
338
 
 
339
 
    if ((session= new Session(plugin::Listen::getNullClient())))
340
 
    {
341
 
      currentSession().release();
342
 
      currentSession().reset(session);
343
 
      transaction_services.sendStartupEvent(session);
344
 
      delete session;
345
 
    }
 
333
    transaction_services.sendStartupEvent(session);
 
334
    session->lockForDelete();
 
335
    delete session;
346
336
  }
347
337
 
348
338
 
351
341
     should be shutdown. */
352
342
  while ((client= plugin::Listen::getClient()) != NULL)
353
343
  {
354
 
    Session::shared_ptr session(new Session(client));
355
 
 
356
 
    if (not session)
 
344
    if (!(session= new Session(client)))
357
345
    {
358
346
      delete client;
359
347
      continue;
360
348
    }
361
349
 
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);
365
353
  }
366
354
 
367
355
  /* Send server shutdown event */
368
 
  {
369
 
    Session *session;
370
 
 
371
 
    if ((session= new Session(plugin::Listen::getNullClient())))
372
 
    {
373
 
      currentSession().release();
374
 
      currentSession().reset(session);
375
 
      transaction_services.sendShutdownEvent(session);
376
 
      delete session;
377
 
    }
378
 
  }
379
 
 
380
 
  {
381
 
    boost::mutex::scoped_lock scopedLock(session::Cache::singleton().mutex());
382
 
    select_thread_in_use= false;                        // For close_connections
383
 
  }
 
356
  if ((session= new Session(plugin::Listen::getNullClient())))
 
357
  {
 
358
    transaction_services.sendShutdownEvent(session);
 
359
    session->lockForDelete();
 
360
    delete session;
 
361
  }
 
362
 
 
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();
385
367
 
386
368
  /* Wait until cleanup is done */
387
369
  {
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);
391
373
  }
392
374