/****************************************************************************
**  SIONLIB     http://www.fz-juelich.de/jsc/sionlib                       **
*****************************************************************************
**  Copyright (c) 2008-2018                                                **
**  Forschungszentrum Juelich, Juelich Supercomputing Centre               **
**                                                                         **
**  See the file COPYRIGHT in the package base directory for details       **
****************************************************************************/

#define _XOPEN_SOURCE 700

#include <sion_debug.h>

#ifdef SION_OMP
#define SION_OMPLOCK
#else
#ifdef SION_OMPI
#define SION_OMPLOCK
#endif
#endif

#ifdef SION_OMPLOCK

static int _lsion_opmi_first_lock = 1;

void _lsion_par_init_debug(void)
{
#pragma omp critical
  {
    if (_lsion_opmi_first_lock) {
      _lsion_opmi_first_lock = 0;
      _lsion_debug_init();
    }
  }
}

#else

void _sion_par_init_lock(void) {}

#endif
