1 /* Copyright (c) 2011-2014. The SimGrid Team.
2 * All rights reserved. */
4 /* This program is free software; you can redistribute it and/or modify it
5 * under the terms of the license (GNU LGPL) which comes with this package. */
10 typedef struct s_smpi_static {
12 void_f_pvoid_t free_fn;
16 * \brief Holds a reference to all static variables that were registered
17 * via smpi_register_static(). This helps to free them when
20 static std::stack<s_smpi_static_t> registered_static_variables_stack;
22 void smpi_register_static(void* arg, void_f_pvoid_t free_fn) {
23 s_smpi_static_t elm { arg, free_fn };
24 registered_static_variables_stack.push(elm);
27 void smpi_free_static() {
28 while (!registered_static_variables_stack.empty()) {
29 s_smpi_static_t elm = registered_static_variables_stack.top();
31 registered_static_variables_stack.pop();