A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
oups! forgot to rest some parts ...
[simgrid.git]
/
src
/
smpi
/
smpi_c99.c
diff --git
a/src/smpi/smpi_c99.c
b/src/smpi/smpi_c99.c
index
2efa529
..
32e0265
100644
(file)
--- a/
src/smpi/smpi_c99.c
+++ b/
src/smpi/smpi_c99.c
@@
-4,13
+4,23
@@
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
-#include <
stdlib
.h>
+#include <
xbt/dynar
.h>
#include "private.h"
#include "private.h"
-static void smpi_free_static(int status, void* arg) {
- free(arg);
+static xbt_dynar_t registered_static_stack = NULL;
+
+void smpi_register_static(void* arg)
+{
+ if (!registered_static_stack)
+ registered_static_stack = xbt_dynar_new(sizeof(void*), NULL);
+ xbt_dynar_push_as(registered_static_stack, void*, arg);
}
}
-void smpi_register_static(void* arg) {
- on_exit(&smpi_free_static, arg);
+void smpi_free_static(void)
+{
+ while (!xbt_dynar_is_empty(registered_static_stack)) {
+ void *p = xbt_dynar_pop_as(registered_static_stack, void*);
+ free(p);
+ }
+ xbt_dynar_free(®istered_static_stack);
}
}