~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/signal_handler/signal_handler.cc

  • Committer: Brian Aker
  • Date: 2010-08-03 04:19:05 UTC
  • mto: This revision was merged to the branch mainline in revision 1684.
  • Revision ID: brian@gaz-20100803041905-xkgqsndtrqf2xetg
Remove call for using special new for a cursor.

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
#include "drizzled/internal/my_pthread.h"
24
24
#include "drizzled/internal/my_sys.h"
25
25
#include "drizzled/plugin/daemon.h"
 
26
#include "drizzled/signal_handler.h"
26
27
 
27
28
#include <sys/stat.h>
28
29
#include <fcntl.h>
67
68
  kill_in_progress=true;
68
69
  abort_loop=1;                                 // This should be set
69
70
  if (sig != 0) // 0 is not a valid signal number
70
 
    my_sigset(sig, SIG_IGN);                    /* purify inspected */
 
71
    ignore_signal(sig);                    /* purify inspected */
71
72
  if (sig == SIGTERM || sig == 0)
72
73
    errmsg_printf(ERRMSG_LVL_INFO, _(ER(ER_NORMAL_SHUTDOWN)),internal::my_progname);
73
74
  else
245
246
  */
246
247
  ~SignalHandler()
247
248
  {
248
 
    uint32_t i;
249
249
    /*
250
 
      Wait up to 10 seconds for signal thread to die. We use this mainly to
 
250
      Wait up to 100000 micro-seconds for signal thread to die. We use this mainly to
251
251
      avoid getting warnings that internal::my_thread_end has not been called
252
252
    */
253
 
    for (i= 0 ; i < 100 && signal_thread_in_use; i++)
 
253
    for (uint32_t i= 0 ; i < 100 && signal_thread_in_use; i++)
254
254
    {
255
255
      if (pthread_kill(signal_thread, SIGTERM) != ESRCH)
256
256
        break;
257
 
      usleep(100);                              // Give it time to die
 
257
 
 
258
      struct timespec tm;
 
259
      tm.tv_sec= 0;
 
260
      tm.tv_nsec= 100000;
 
261
 
 
262
      nanosleep(&tm, NULL);                             // Give it time to die
258
263
    }
259
264
 
260
265
  }
261
266
};
262
267
 
263
 
static int init(drizzled::plugin::Context& context)
 
268
static int init(drizzled::module::Context& context)
264
269
{
265
270
  SignalHandler *handler= new SignalHandler;
266
271
  context.add(handler);