~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to client/drizzleslap.cc

  • Committer: Brian Aker
  • Date: 2010-11-01 06:01:49 UTC
  • mto: (1897.2.1 merge)
  • mto: This revision was merged to the branch mainline in revision 1898.
  • Revision ID: brian@tangent.org-20101101060149-h3d803b1zcbnolp5
Updating with moving out wakeup to its own file. Why not use barrier for
boost? Barrier can't be dynamically set, and we don't know how many threads
until the threads have been created.

Show diffs side-by-side

added added

removed removed

Lines of Context:
78
78
#include "stats.h"
79
79
#include "thread_context.h"
80
80
#include "conclusions.h"
 
81
#include "wakeup.h"
81
82
 
82
83
#include <signal.h>
83
84
#include <stdarg.h>
94
95
#include <iostream>
95
96
#include <fstream>
96
97
#include <drizzled/configmake.h>
 
98
 
97
99
/* Added this for string translation. */
98
100
#include <drizzled/gettext.h>
99
101
 
120
122
uint32_t thread_counter;
121
123
boost::mutex counter_mutex;
122
124
boost::condition_variable_any count_threshhold;
123
 
bool master_wakeup;
124
 
boost::mutex sleeper_mutex;
125
 
boost::condition_variable_any sleep_threshhold;
 
125
 
 
126
client::Wakeup master_wakeup;
126
127
 
127
128
/* Global Thread timer */
128
129
static bool timer_alarm= false;
275
276
  drizzle_row_t row;
276
277
  Statement *ptr;
277
278
 
278
 
  sleeper_mutex.lock();
279
 
  while (master_wakeup)
280
 
  {
281
 
    sleep_threshhold.wait(sleeper_mutex);
282
 
  }
283
 
  sleeper_mutex.unlock();
 
279
  master_wakeup.wait();
284
280
 
285
281
  slap_connect(con, true);
286
282
 
1905
1901
    We lock around the initial call in case were we in a loop. This
1906
1902
    also keeps the value properly syncronized across call threads.
1907
1903
  */
1908
 
  sleeper_mutex.lock();
1909
 
  while (master_wakeup)
1910
 
  {
1911
 
    sleep_threshhold.wait(sleeper_mutex);
1912
 
  }
1913
 
  sleeper_mutex.unlock();
 
1904
  master_wakeup.wait();
1914
1905
 
1915
1906
  {
1916
1907
    boost::mutex::scoped_lock scopedLock(timer_alarm_mutex);
1939
1930
    OptionString *sql_type;
1940
1931
    thread_counter= 0;
1941
1932
 
1942
 
    {
1943
 
      boost::mutex::scoped_lock scopedWakeup(sleeper_mutex);
1944
 
      master_wakeup= true;
1945
 
    }
 
1933
    master_wakeup.reset();
1946
1934
 
1947
1935
    real_concurrency= 0;
1948
1936
 
1998
1986
    }
1999
1987
  }
2000
1988
 
2001
 
  {
2002
 
    boost::mutex::scoped_lock scopedSleeper(sleeper_mutex);
2003
 
    master_wakeup= false;
2004
 
  }
2005
 
  sleep_threshhold.notify_all();
 
1989
  master_wakeup.start();
2006
1990
 
2007
1991
  gettimeofday(&start_time, NULL);
2008
1992