#include "rcs_defs.hh"
#include <string.h>
#include <signal.h>
#include <sys/types.h>
#include <unistd.h>
#include <sys/wait.h>
#include <stdlib.h>
#include "nml.hh"
#include "nmlmsg.hh"
#include "cms.hh"
#include "nml_srv.hh"
#include "rem_msg.hh"
#include "rcs_prnt.hh"
#include "timer.hh"
#include "rcs_exit.hh"
#include "dbg_mem.h"
#include "cmsdiag.hh"
Include dependency graph for nml_srv.cc:
Go to the source code of this file.
Functions | |
void | catch_control_C1 (int sig) |
void | catch_control_C2 (int sig) |
void | run_nml_server_exit (int i) |
void RCS_EXPORT | run_nml_servers () |
void RCS_EXPORT | spawn_nml_servers () |
void RCS_EXPORT | kill_nml_servers () |
void RCS_EXPORT | nml_server_cleanup () |
Variables | |
RCS_EXPORT NML_SUPER_SERVER * | NML_Default_Super_Server |
int | nml_control_C_caught = 0 |
int | nml_sigint_count = 0 |
int | dont_kill_servers = 0 |
int | dont_cleanup_servers = 0 |
int | nmlsrv_last_sig = 0 |
|
Definition at line 611 of file nml_srv.cc. 00613 { 00614 nmlsrv_last_sig = sig; 00615 nml_sigint_count++; 00616 #ifndef WIN32 00617 signal (SIGINT, SIG_DFL); 00618 #endif 00619 if (NULL != NML_Default_Super_Server) 00620 { 00621 #ifdef VXWORKS 00622 NML_Default_Super_Server->delete_all_servers (); 00623 if (NULL != NML_Default_Super_Server->servers) 00624 { 00625 if (0 == NML_Default_Super_Server->servers->list_size) 00626 { 00627 #endif 00628 delete NML_Default_Super_Server; 00629 NML_Default_Super_Server = (NML_SUPER_SERVER *) NULL; 00630 #ifdef VXWORKS 00631 } 00632 } 00633 #endif 00634 } 00635 #ifdef VXWORKS 00636 taskLock (); 00637 #endif 00638 dont_kill_servers = 1; 00639 dont_cleanup_servers = 1; 00640 nml_cleanup (); 00641 dont_kill_servers = 0; 00642 dont_cleanup_servers = 0; 00643 #ifdef VXWORKS 00644 taskUnlock (); 00645 #endif 00646 #ifdef UNDER_CE 00647 ExitThread (0); 00648 #else 00649 exit (0); 00650 #endif 00651 #ifdef WIN32 00652 return (0); // Just to please the compiler. 00653 #endif 00654 } /* */ |
|
Definition at line 661 of file nml_srv.cc. 00663 { 00664 nmlsrv_last_sig = sig; 00665 #ifndef WIN32 00666 signal (SIGINT, SIG_DFL); 00667 #endif 00668 nml_control_C_caught = 1; 00669 #if defined(WIN32) && !defined(gnuwin32) 00670 return (0); 00671 #endif 00672 } |
|
Definition at line 675 of file nml_srv.cc. Referenced by run_nml_servers().
|
|
Definition at line 686 of file nml_srv.cc. Referenced by main(), and run_perfsvr().
00687 { 00688 #if defined(sun4os5) || defined(__MSDOS__) && !defined(WIN32) 00689 atexit (nml_cleanup); 00690 #endif 00691 if (NULL != NML_Default_Super_Server) 00692 { 00693 if (NML_Default_Super_Server->servers != NULL) 00694 { 00695 if (NML_Default_Super_Server->servers->list_size < 00696 NML_Default_Super_Server->unspawned_servers) 00697 { 00698 NML_Default_Super_Server->unspawned_servers = 00699 NML_Default_Super_Server->servers->list_size; 00700 } 00701 if (NML_Default_Super_Server->unspawned_servers <= 0) 00702 { 00703 rcs_print_error 00704 ("run_nml_servers(): No buffers without servers already spawned for them.\n"); 00705 return; 00706 } 00707 if (NML_Default_Super_Server->unspawned_servers == 1) 00708 { 00709 NML_Default_Super_Server->unspawned_servers = 0; 00710 NML_SERVER *sole_server; 00711 sole_server = 00712 (NML_SERVER *) NML_Default_Super_Server->servers->get_head (); 00713 while (sole_server != NULL) 00714 { 00715 if (NULL != sole_server->remote_port) 00716 { 00717 if (!sole_server->remote_port->running && 00718 !sole_server->server_spawned) 00719 { 00720 break; 00721 } 00722 } 00723 sole_server = 00724 (NML_SERVER *) NML_Default_Super_Server->servers-> 00725 get_next (); 00726 } 00727 if (NULL == sole_server) 00728 { 00729 rcs_print_error 00730 ("run_nml_servers() : sole_server is NULL.\n"); 00731 run_nml_server_exit (-1); 00732 } 00733 else 00734 { 00735 #ifndef UNDER_CE 00736 #if defined(WIN32) && !defined(gnuwin32) 00737 SetConsoleCtrlHandler (catch_control_C1, TRUE); 00738 #else 00739 #ifdef sparcworks_sun4 00740 signal (SIGINT, (void (*)(int,...)) catch_control_C1); 00741 #else 00742 signal (SIGINT, catch_control_C1); 00743 #endif 00744 #endif 00745 #endif 00746 sole_server->run (0); 00747 run_nml_server_exit (-1); 00748 } 00749 } 00750 else 00751 { 00752 nml_control_C_caught = 0; 00753 NML_Default_Super_Server->spawn_all_servers (); 00754 #ifndef UNDER_CE 00755 #if defined(WIN32) && !defined(gnuwin32) 00756 SetConsoleCtrlHandler (catch_control_C2, TRUE); 00757 #else 00758 #ifdef sparcworks_sun4 00759 signal (SIGINT, (void (*)(int,...)) catch_control_C2); 00760 #else 00761 signal (SIGINT, catch_control_C2); 00762 #endif 00763 #endif 00764 #endif 00765 while (!nml_control_C_caught) 00766 esleep (2.0); 00767 NML_Default_Super_Server->kill_all_servers (); 00768 nml_cleanup (); 00769 run_nml_server_exit (0); 00770 } 00771 } 00772 else 00773 { 00774 rcs_print_error 00775 ("run_nml_servers(): No buffers without servers already spawned for them.\n"); 00776 } 00777 } 00778 else 00779 { 00780 rcs_print_error 00781 ("run_nml_servers(): No buffers without servers already spawned for them.\n"); 00782 } 00783 run_nml_server_exit (-1); 00784 } |
|
Definition at line 787 of file nml_srv.cc. Referenced by nml_start().
00788 { 00789 if (NULL != NML_Default_Super_Server) 00790 { 00791 NML_Default_Super_Server->spawn_all_servers (); 00792 } 00793 } |
|
Definition at line 796 of file nml_srv.cc. 00797 { 00798 if (!dont_kill_servers) 00799 { 00800 if (NULL != NML_Default_Super_Server) 00801 { 00802 NML_Default_Super_Server->kill_all_servers (); 00803 } 00804 } 00805 } |
|
Definition at line 808 of file nml_srv.cc. Referenced by nml_cleanup().
00809 { 00810 if (!dont_cleanup_servers) 00811 { 00812 if (NULL != NML_Default_Super_Server) 00813 { 00814 NML_Default_Super_Server->kill_all_servers (); 00815 NML_Default_Super_Server->delete_all_servers (); 00816 #ifdef VXWORKS 00817 if (NULL != NML_Default_Super_Server->servers) 00818 { 00819 if (0 == NML_Default_Super_Server->servers->list_size) 00820 { 00821 #endif 00822 delete NML_Default_Super_Server; 00823 NML_Default_Super_Server = (NML_SUPER_SERVER *) NULL; 00824 #ifdef VXWORKS 00825 } 00826 } 00827 #endif 00828 } 00829 } 00830 } |
|
Initial value: (NML_SUPER_SERVER *) NULL Definition at line 419 of file nml_srv.cc. |
|
Definition at line 600 of file nml_srv.cc. |
|
Definition at line 601 of file nml_srv.cc. |
|
Definition at line 602 of file nml_srv.cc. |
|
Definition at line 603 of file nml_srv.cc. |
|
Definition at line 604 of file nml_srv.cc. |