diff --git a/oshmem/include/oshmem_config.h b/oshmem/include/oshmem_config.h index 8ea9ac09e0c..d5d44ebf920 100644 --- a/oshmem/include/oshmem_config.h +++ b/oshmem/include/oshmem_config.h @@ -2,7 +2,9 @@ * * Copyright (c) 2013 Mellanox Technologies, Inc. * All rights reserved. - * Copyright (c) 2013 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2013 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2016 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -52,9 +54,6 @@ # ifndef OSHMEM_MODULE_DECLSPEC # define OSHMEM_MODULE_DECLSPEC __opal_attribute_visibility__("default") # endif -# ifndef OSHMEM_DESTRUCTOR -# define OSHMEM_DESTRUCTOR __opal_attribute_destructor__ -# endif # else # ifndef OSHMEM_DECLSPEC # define OSHMEM_DECLSPEC @@ -62,9 +61,6 @@ # ifndef OSHMEM_MODULE_DECLSPEC # define OSHMEM_MODULE_DECLSPEC # endif -# ifndef OSHMEM_DESTRUCTOR -# define OSHMEM_DESTRUCTOR -# endif # endif #endif /* defined(__WINDOWS__) */ diff --git a/oshmem/include/pshmem.h b/oshmem/include/pshmem.h index 3645ce268b3..dd090dadcf9 100644 --- a/oshmem/include/pshmem.h +++ b/oshmem/include/pshmem.h @@ -2,6 +2,8 @@ * Copyright (c) 2014-2016 Mellanox Technologies, Inc. * All rights reserved. * Copyright (c) 2014 Intel, Inc. All rights reserved + * Copyright (c) 2016 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -32,14 +34,6 @@ # endif #endif -#ifndef OSHMEM_DESTRUCTOR -# if defined(OPAL_C_HAVE_VISIBILITY) && (OPAL_C_HAVE_VISIBILITY == 1) -# define OSHMEM_DESTRUCTOR __attribute__((__destructor__)) -# else -# define OSHMEM_DESTRUCTOR -# endif -#endif - #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) #define OSHMEMP_HAVE_C11 1 #else @@ -65,7 +59,7 @@ OSHMEM_DECLSPEC void pshmem_global_exit(int status); /* * Finalization routines */ -OSHMEM_DECLSPEC void pshmem_finalize(void) OSHMEM_DESTRUCTOR; +OSHMEM_DECLSPEC void pshmem_finalize(void); /* * Query routines diff --git a/oshmem/include/shmem.h.in b/oshmem/include/shmem.h.in index 492fa386363..a57431e7e47 100644 --- a/oshmem/include/shmem.h.in +++ b/oshmem/include/shmem.h.in @@ -2,6 +2,8 @@ * Copyright (c) 2014-2016 Mellanox Technologies, Inc. * All rights reserved. * Copyright (c) 2014 Intel, Inc. All rights reserved + * Copyright (c) 2016 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -39,14 +41,6 @@ # endif #endif -#ifndef OSHMEM_DESTRUCTOR -# if defined(OPAL_C_HAVE_VISIBILITY) && (OPAL_C_HAVE_VISIBILITY == 1) -# define OSHMEM_DESTRUCTOR __attribute__((__destructor__)) -# else -# define OSHMEM_DESTRUCTOR -# endif -#endif - #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) #define OSHMEM_HAVE_C11 1 #else @@ -123,7 +117,7 @@ enum shmem_wait_ops { * Initialization routines */ OSHMEM_DECLSPEC void shmem_init(void); -OSHMEM_DECLSPEC void shmem_finalize(void) OSHMEM_DESTRUCTOR; +OSHMEM_DECLSPEC void shmem_finalize(void); OSHMEM_DECLSPEC void shmem_global_exit(int status); /* diff --git a/oshmem/shmem/c/shmem_init.c b/oshmem/shmem/c/shmem_init.c index 010483f80d2..f02d759112b 100644 --- a/oshmem/shmem/c/shmem_init.c +++ b/oshmem/shmem/c/shmem_init.c @@ -3,6 +3,8 @@ * All rights reserved. * Copyright (c) 2015 Los Alamos National Security, LLC. * All rights reserved. + * Copyright (c) 2016 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -50,6 +52,7 @@ void start_pes(int npes) static void shmem_onexit(int exitcode, void *arg) { oshmem_shmem_globalexit_status = exitcode; + shmem_finalize(); } static inline void _shmem_init(void)