FACT++  1.0
void cleanUp ( )

Definition at line 3159 of file feeserver.c.

References deleteCharItemList(), deleteIntItemList(), deleteItemList(), dis_stop_serving, and Memory::free().

Referenced by add_char_item_node(), add_int_item_node(), add_item_node(), createHeader(), fee_exit_handler(), interrupt_handler(), marshallHeader(), start(), triggerRestart(), and updateFeeServer().

3159  {
3160  // the order of the clean up sequence here is important to evade seg faults
3161 # ifdef __DEBUG
3162  printf("Cleaning up FeeServer before finishing:\n");
3163  fflush(stdout);
3164 # endif
3165  if (ceInitState == CE_OK) {
3166  cleanUpCE();
3167 # ifdef __DEBUG
3168  printf(" - Clean up of CE finished\n");
3169  fflush(stdout);
3170 # endif
3171  }
3172 
3173  if (monitorThreadStarted) {
3174  pthread_cancel(thread_mon);
3175  }
3177  pthread_cancel(thread_mon_int);
3178  }
3179  if (state == RUNNING) {
3180  pthread_cancel(thread_init);
3181  }
3182  if (logWatchDogRunning) {
3183  pthread_cancel(thread_logWatchdog);
3184  }
3185 # ifdef __DEBUG
3186  printf(" - All threads except for main thread killed\n");
3187  fflush(stdout);
3188 # endif
3189 
3190  dis_stop_serving();
3191 # ifdef __DEBUG
3192  printf(" - DIM server stopped\n");
3193  fflush(stdout);
3194 # endif
3195 
3196  deleteItemList();
3197  // new since version 0.8.1 -> int channels
3199  // new since version 0.8.2b -> char channels
3201 
3202  if (cmndACK != 0) {
3203  free(cmndACK);
3204  }
3205  if (serverName != 0) {
3206  free(serverName);
3207  }
3208 
3209  // new since 0.8.3 -> memory list
3210  //cleanupMemoryList();
3211 # ifdef __DEBUG
3212  printf(" - Memory freed (lists and globaly allocated)\n");
3213  fflush(stdout);
3214 # endif
3215 }
static pthread_t thread_mon_int
Definition: feeserver.c:299
static bool intMonitorThreadStarted
Definition: feeserver.c:307
int deleteItemList()
Definition: feeserver.c:3217
static pthread_t thread_logWatchdog
Definition: feeserver.c:236
static pthread_t thread_mon
Definition: feeserver.c:223
#define dis_stop_serving
Definition: dis.h:9
static char * cmndACK
Definition: feeserver.c:171
static int ceInitState
Definition: feeserver.c:83
static char * serverName
Definition: feeserver.c:183
void free(void *mem)
static pthread_t thread_init
Definition: feeserver.c:217
static bool monitorThreadStarted
Definition: feeserver.c:147
static bool logWatchDogRunning
Definition: feeserver.c:122
int deleteCharItemList()
Definition: feeserver.c:4139
int deleteIntItemList()
Definition: feeserver.c:3409

+ Here is the call graph for this function:

+ Here is the caller graph for this function: