~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/pool_of_threads/pool_of_threads.cc

  • Committer: Monty Taylor
  • Date: 2009-02-11 04:52:41 UTC
  • mfrom: (877 drizzle)
  • mto: This revision was merged to the branch mainline in revision 879.
  • Revision ID: mordred@inaugust.com-20090211045241-l3xho3ifn3dq8xu0
MergedĀ fromĀ trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
static uint32_t created_threads, killed_threads;
30
30
static bool kill_pool_threads;
31
31
 
 
32
static int deinit(void *);
 
33
 
32
34
static struct event session_add_event;
33
35
static struct event session_kill_event;
34
36
 
46
48
static LIST *sessions_need_processing; /* list of sessions that needs some processing */
47
49
static LIST *sessions_waiting_for_io; /* list of sessions with added events */
48
50
 
49
 
static void libevent_end();
50
51
static bool libevent_needs_immediate_processing(Session *session);
51
52
static void libevent_connection_close(Session *session);
52
53
void libevent_session_add(Session* session);
125
126
 if (event_add(&session_add_event, NULL) || event_add(&session_kill_event, NULL))
126
127
 {
127
128
   errmsg_printf(ERRMSG_LVL_ERROR, _("session_add_event event_add error in libevent_init\n"));
128
 
   libevent_end();
 
129
   deinit(NULL);
129
130
   return true;
130
131
 
131
132
 }
143
144
      errmsg_printf(ERRMSG_LVL_ERROR, _("Can't create completion port thread (error %d)"),
144
145
                      error);
145
146
      pthread_mutex_unlock(&LOCK_thread_count);
146
 
      libevent_end();                      // Cleanup
 
147
      deinit(NULL);                      // Cleanup
147
148
      return true;
148
149
    }
149
150
  }
522
523
  Wait until all pool threads have been deleted for clean shutdown
523
524
*/
524
525
 
525
 
static void libevent_end()
 
526
static int deinit(void *)
526
527
{
527
528
  (void) pthread_mutex_lock(&LOCK_thread_count);
528
529
 
546
547
 
547
548
  (void) pthread_mutex_destroy(&LOCK_event_loop);
548
549
  (void) pthread_mutex_destroy(&LOCK_session_add);
549
 
  return;
 
550
 
 
551
  return 0;
550
552
}
551
553
 
552
554
static int init(void *p)
561
563
  return (int)libevent_init();
562
564
}
563
565
 
564
 
static int deinit(void *)
565
 
{
566
 
  fprintf(stderr, "Entering pool shutdown \n");
567
 
  libevent_end();
568
 
  return 0;
569
 
}
570
 
 
571
566
/* 
572
567
  The defaults here were picked based on what I see (aka Brian). They should
573
568
  be vetted across a larger audience.