~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/signal_handler/signal_handler.cc

  • Committer: Monty Taylor
  • Date: 2010-02-04 08:14:46 UTC
  • mfrom: (1277.2.1 build) (1280.2.1 build)
  • mto: This revision was merged to the branch mainline in revision 1283.
  • Revision ID: mordred@inaugust.com-20100204081446-ldh9m486va30uap6
Put everything in drizzled into drizzled namespace.
Put internal stuff into drizzled::internal namespace.
Removed some cruft.
Now every symbol that is shipped in a header is in the drizzled namespace
and everything in the server that's not shipped is labeled internal. woot. 
Removed a lot of the extra extern "C" stuff that was in there. Less ugliness for
internal callbacks now for Sun Studio.

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
#include <sys/stat.h>
27
27
#include <fcntl.h>
28
28
 
 
29
 
29
30
static bool kill_in_progress= false;
30
31
static bool volatile signal_thread_in_use= false;
 
32
extern "C" pthread_handler_t signal_hand(void *);
 
33
 
 
34
namespace drizzled
 
35
{
31
36
extern int cleanup_done;
32
 
extern "C" pthread_handler_t signal_hand(void *);
33
37
extern bool volatile abort_loop;
34
38
extern bool volatile shutdown_in_progress;
35
39
extern char pidfile_name[FN_REFLEN];
36
 
 
37
 
extern std::bitset<12> test_flags;
38
 
 
39
40
/* Prototypes -> all of these should be factored out into a propper shutdown */
40
41
extern void close_connections(void);
 
42
extern std::bitset<12> test_flags;
 
43
}
 
44
 
 
45
using namespace drizzled;
 
46
 
41
47
 
42
48
 
43
49
/**
62
68
  if (sig != 0) // 0 is not a valid signal number
63
69
    my_sigset(sig, SIG_IGN);                    /* purify inspected */
64
70
  if (sig == SIGTERM || sig == 0)
65
 
    errmsg_printf(ERRMSG_LVL_INFO, _(ER(ER_NORMAL_SHUTDOWN)),my_progname);
 
71
    errmsg_printf(ERRMSG_LVL_INFO, _(ER(ER_NORMAL_SHUTDOWN)),internal::my_progname);
66
72
  else
67
 
    errmsg_printf(ERRMSG_LVL_ERROR, _(ER(ER_GOT_SIGNAL)),my_progname,sig);
 
73
    errmsg_printf(ERRMSG_LVL_ERROR, _(ER(ER_GOT_SIGNAL)),internal::my_progname,sig);
68
74
 
69
75
  close_connections();
70
76
  if (sig != SIGTERM && sig != 0)
106
112
{
107
113
  sigset_t set;
108
114
  int sig;
109
 
  my_thread_init();                             // Init new thread
 
115
  internal::my_thread_init();                           // Init new thread
110
116
  signal_thread_in_use= true;
111
117
 
112
 
  if (thd_lib_detected != THD_LIB_LT && 
 
118
  if (internal::thd_lib_detected != THD_LIB_LT && 
113
119
      (test_flags.test(TEST_SIGINT)))
114
120
  {
115
121
    (void) sigemptyset(&set);                   // Setup up SIGINT for debug
164
170
      while ((error= sigwait(&set,&sig)) == EINTR) ;
165
171
    if (cleanup_done)
166
172
    {
167
 
      my_thread_end();
 
173
      internal::my_thread_end();
168
174
      signal_thread_in_use= false;
169
175
 
170
176
      return NULL;
244
250
  uint32_t i;
245
251
  /*
246
252
    Wait up to 10 seconds for signal thread to die. We use this mainly to
247
 
    avoid getting warnings that my_thread_end has not been called
 
253
    avoid getting warnings that internal::my_thread_end has not been called
248
254
  */
249
255
  for (i= 0 ; i < 100 && signal_thread_in_use; i++)
250
256
  {