Exemplo n.º 1
0
//--------------------------------------------------------------------------
static void NT_CDECL shutdown_gracefully(int signum)
{
  qeprintf("got signal #%d\n", signum);

#ifdef __SINGLE_THREADED_SERVER__

  if ( g_global_server != NULL )
  {
    debmod_t *d = g_global_server->get_debugger_instance();
    if ( d != NULL )
      d->dbg_exit_process();
    g_global_server->term_irs();
  }
#else
  qmutex_lock(g_lock);

  for (rpc_server_list_t::iterator it = clients_list.begin(); it != clients_list.end();++it)
  {
    rpc_server_t *server = it->first;
    qthread_t thr = it->second;

    // free thread
    if ( thr != NULL )
      qthread_free(thr);

    if ( server == NULL || server->irs == NULL )
      continue;

    debmod_t *d = server->get_debugger_instance();
    if ( d != NULL )
      d->dbg_exit_process(); // kill the process instead of letting it run in wild

    server->term_irs();
  }

  clients_list.clear();
  qmutex_unlock(g_lock);
  qmutex_free(g_lock);
#endif

  if ( listen_socket != INVALID_SOCKET )
    closesocket(listen_socket);

  term_subsystem();
  _exit(1);
}
Exemplo n.º 2
0
disp_request_t::~disp_request_t() {
   flush();
   qmutex_free(mtx);
};
Exemplo n.º 3
0
//--------------------------------------------------------------------------
static inline bool srv_lock_free(void)
{
  return qmutex_free(g_lock);
}