#include <stdio.h>
#include <stdlib.h>
#include "chpl_rt_utils_static.h"
#include "chpl-comm.h"
#include "chplexit.h"
#include "chpl-mem.h"
#include "chplmemtrack.h"
#include "chplrt.h"
#include "gdb.h"

#undef exit

static void chpl_exit_common(int status, int all) {
  fflush(stdout);
  fflush(stderr);
  if (status != 0) {
    gdbShouldBreakHere();
  }
  if (all) {
    chpl_comm_barrier("chpl_comm_exit_all");
    chpl_comm_stopPollingTask();
    chpl_task_exit();
    chpl_reportMemInfo();
    chpl_mem_exit();
    chpl_comm_exit_all(status);
  } else {
    chpl_mem_exit();
    chpl_comm_exit_any(status);
  }
  exit(status);
}


void chpl_exit_all(int status) {
  chpl_exit_common(status, 1);
}


void chpl_exit_any(int status) {
  chpl_exit_common(status, 0);
}

#include <stdio.h>
#include <stdlib.h>
#include "chpl_rt_utils_static.h"
#include "chpl-comm.h"
#include "chplexit.h"
#include "chpl-mem.h"
#include "chplmemtrack.h"
#include "chplrt.h"
#include "gdb.h"

#undef exit

static void chpl_exit_common(int status, int all) {
  fflush(stdout);
  fflush(stderr);
  if (status != 0) {
    gdbShouldBreakHere();
  }
  if (all) {
    chpl_comm_barrier("chpl_exit_common");
    chpl_comm_stopPollingTask();
    chpl_task_exit();
    chpl_reportMemInfo();
    chpl_mem_exit();
    chpl_comm_exit_all(status);
  } else {
    chpl_mem_exit();
    chpl_comm_exit_any(status);
  }
  exit(status);
}


void chpl_exit_all(int status) {
  chpl_exit_common(status, 1);
}


void chpl_exit_any(int status) {
  chpl_exit_common(status, 0);
}

Clarify the debug message that may be generated by the chpl_comm_barrier() call in chpl_exit_common().
Clarify the debug message that may be generated by the
chpl_comm_barrier() call in chpl_exit_common().


git-svn-id: 88467cb1fb04b8a755be7e1ee1026be4190196ef@19217 3a8e244f-b0f2-452b-bcba-4c88e055c3ca
