blob: 066af444453183e0a0cdee6b7aad20fd83d48f4c [file] [log] [blame]
/**********************************************************************
// @@@ START COPYRIGHT @@@
//
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
//
// @@@ END COPYRIGHT @@@
**********************************************************************/
#include <assert.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "Platform.h"
#include "seabed/ms.h"
#include "seabed/fs.h"
#define FALSE 0
void
my_mpi_close()
{
static short bMpiCloseCalled = 0;
if (bMpiCloseCalled == 1) {
return;
}
bMpiCloseCalled = 1;
#ifdef MPI_
msg_mon_process_shutdown();
#endif
}
void
my_mpi_fclose()
{
static Int32 sv_called_count = 0;
static Int32 sv_retcode = -999;
#ifdef MPI_
if ( ++sv_called_count > 2000000000 ) //Don't allow it to overflow to zero, but
sv_called_count = 2000000000 ; //keep the fact that it is very large.
if (sv_called_count == 1)
sv_retcode = file_mon_process_shutdown();
#endif
}
short my_mpi_setup (Int32* argc, char** argv[] )
{
static short bMpiSetupCalled = 0;
short retcode = 0;
if (bMpiSetupCalled == 1) {
return 0;
}
bMpiSetupCalled = 1;
#ifdef MPI_
file_init_attach(argc,argv,1,(char *)"");
retcode = file_mon_process_startup(1); /* server? */ /* ADD */
#endif
if (retcode == 0) {
msg_debug_hook("NGG", "ngg.hook");
atexit(my_mpi_fclose);
}
return retcode;
}