~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to sql/scheduler.cc

  • Committer: brian
  • Date: 2008-07-03 13:40:21 UTC
  • Revision ID: brian@localhost.localdomain-20080703134021-7p4ab3xpjpmbcebi
Update for using real bool types.

Show diffs side-by-side

added added

removed removed

Lines of Context:
81
81
 
82
82
/*
83
83
  Create a pipe and set to non-blocking.
84
 
  Returns TRUE if there is an error.
 
84
  Returns true if there is an error.
85
85
*/
86
86
 
87
87
static bool init_pipe(int pipe_fds[])
101
101
*/
102
102
 
103
103
thd_scheduler::thd_scheduler()
104
 
  : logged_in(FALSE), io_event(NULL), thread_attached(FALSE)
 
104
  : logged_in(false), io_event(NULL), thread_attached(false)
105
105
{  
106
106
#ifndef DBUG_OFF
107
107
  dbug_explain_buf[0]= 0;
123
123
  if (!io_event)
124
124
  {
125
125
    sql_print_error("Memory allocation error in thd_scheduler::init\n");
126
 
    return TRUE;
 
126
    return true;
127
127
  }
128
128
  
129
129
  event_set(io_event, parent_thd->net.vio->sd, EV_READ, 
131
131
    
132
132
  list.data= parent_thd;
133
133
  
134
 
  return FALSE;
 
134
  return false;
135
135
}
136
136
 
137
137
 
146
146
  if (libevent_should_close_connection(thd) ||
147
147
      setup_connection_thread_globals(thd))
148
148
  {
149
 
    return TRUE;
 
149
    return true;
150
150
  }
151
151
  my_errno= 0;
152
152
  thd->mysys_var->abort= 0;
153
 
  thread_attached= TRUE;
 
153
  thread_attached= true;
154
154
#ifndef DBUG_OFF
155
155
  swap_dbug_explain();
156
156
#endif
157
 
  return FALSE;
 
157
  return false;
158
158
}
159
159
 
160
160
 
168
168
  {
169
169
    THD* thd = (THD*)list.data;
170
170
    thd->mysys_var= NULL;
171
 
    thread_attached= FALSE;
 
171
    thread_attached= false;
172
172
#ifndef DBUG_OFF
173
173
    swap_dbug_explain();
174
174
#endif
217
217
  
218
218
  created_threads= 0;
219
219
  killed_threads= 0;
220
 
  kill_pool_threads= FALSE;
 
220
  kill_pool_threads= false;
221
221
  
222
222
  pthread_mutex_init(&LOCK_event_loop, NULL);
223
223
  pthread_mutex_init(&LOCK_thd_add, NULL);
263
263
                      error);
264
264
      pthread_mutex_unlock(&LOCK_thread_count);
265
265
      libevent_end();                      // Cleanup
266
 
      DBUG_RETURN(TRUE);
 
266
      DBUG_RETURN(true);
267
267
    }
268
268
  }
269
269
 
273
273
  pthread_mutex_unlock(&LOCK_thread_count);
274
274
  
275
275
  DBUG_PRINT("info", ("%u threads created", (uint) thread_pool_size));
276
 
  DBUG_RETURN(FALSE);
 
276
  DBUG_RETURN(false);
277
277
}
278
278
 
279
279
 
552
552
      else
553
553
      {
554
554
        /* login successful */
555
 
        thd->scheduler.logged_in= TRUE;
 
555
        thd->scheduler.logged_in= true;
556
556
        prepare_new_connection_state(thd);
557
557
        if (!libevent_needs_immediate_processing(thd))
558
558
          continue; /* New connection is now waiting for data in libevent*/
583
583
 
584
584
 
585
585
/*
586
 
  Returns TRUE if the connection needs immediate processing and FALSE if 
 
586
  Returns true if the connection needs immediate processing and false if 
587
587
  instead it's queued for libevent processing or closed,
588
588
*/
589
589
 
592
592
  if (libevent_should_close_connection(thd))
593
593
  {
594
594
    libevent_connection_close(thd);
595
 
    return FALSE;
 
595
    return false;
596
596
  }
597
597
  /*
598
 
    If more data in the socket buffer, return TRUE to process another command.
 
598
    If more data in the socket buffer, return true to process another command.
599
599
 
600
600
    Note: we cannot add for event processing because the whole request might
601
601
    already be buffered and we wouldn't receive an event.
602
602
  */
603
603
  if (thd->net.vio == 0 || thd->net.vio->read_pos < thd->net.vio->read_end)
604
 
    return TRUE;
 
604
    return true;
605
605
  
606
606
  thd->scheduler.thread_detach();
607
607
  libevent_thd_add(thd);
608
 
  return FALSE;
 
608
  return false;
609
609
}
610
610
 
611
611
 
643
643
  
644
644
  (void) pthread_mutex_lock(&LOCK_thread_count);
645
645
  
646
 
  kill_pool_threads= TRUE;
 
646
  kill_pool_threads= true;
647
647
  while (killed_threads != created_threads)
648
648
  {
649
649
    /* wake up the event loop */