Changeset 5665
- Timestamp:
- 11/02/09 17:31:00 (3 weeks ago)
- Location:
- mpich2/trunk/src
- Files:
-
- 3 modified
-
include/mpiimpl.h (modified) (2 diffs)
-
mpi/pt2pt/greq_start.c (modified) (3 diffs)
-
util/mem/handlemem.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
mpich2/trunk/src/include/mpiimpl.h
r5623 r5665 2168 2168 2169 2169 #define MPIR_FINALIZE_CALLBACK_PRIO 5 2170 #define MPIR_FINALIZE_CALLBACK_HANDLE_CHECK_PRIO 1 2171 #define MPIR_FINALIZE_CALLBACK_DEFAULT_PRIO 0 2170 2172 #define MPIR_FINALIZE_CALLBACK_MAX_PRIO 10 2171 2173 … … 3152 3154 MPIX_Grequest_poll_function *poll_fn; 3153 3155 MPIX_Grequest_wait_function *wait_fn; 3156 struct MPID_Grequest_class *next; 3154 3157 } MPID_Grequest_class; 3155 3158 -
mpich2/trunk/src/mpi/pt2pt/greq_start.c
r5355 r5665 17 17 /* -- End Profiling Symbol Block */ 18 18 19 PMPI_LOCAL int MPIR_Grequest_free_classes_on_finalize(void *extra_data); 20 19 21 /* Define MPICH_MPI_FROM_PMPI if weak symbols are not supported to build 20 22 the MPI routines. You can use USE_WEAK_SYMBOLS to see if MPICH is … … 36 38 MPID_GREQ_CLASS_PREALLOC, }; 37 39 40 /* We jump through some minor hoops to manage the list of classes ourselves and 41 * only register a single finalizer to avoid hitting limitations in the current 42 * finalizer code. If the finalizer implementation is ever revisited this code 43 * is a good candidate for registering one callback per greq class and trimming 44 * some of this logic. */ 45 int MPIR_Grequest_registered_finalizer = 0; 46 MPID_Grequest_class *MPIR_Grequest_class_list = NULL; 47 38 48 /* Any internal routines can go here. Make them static if possible. If they 39 49 are used by both the MPI and PMPI versions, use PMPI_LOCAL instead of 40 50 static; this macro expands into "static" if weak symbols are supported and 41 51 into nothing otherwise. */ 52 PMPI_LOCAL int MPIR_Grequest_free_classes_on_finalize(void *extra_data ATTRIBUTE((unused))) 53 { 54 int mpi_errno = MPI_SUCCESS; 55 MPID_Grequest_class *last = NULL; 56 MPID_Grequest_class *cur = MPIR_Grequest_class_list; 57 58 /* FIXME MT this function is not thread safe when using fine-grained threading */ 59 MPIR_Grequest_class_list = NULL; 60 while (cur) { 61 last = cur; 62 cur = last->next; 63 MPIU_Handle_obj_free(&MPID_Grequest_class_mem, last); 64 } 65 66 return mpi_errno; 67 } 68 42 69 #else 43 70 extern MPID_Grequest_class MPID_Grequest_class_direct[]; 44 71 extern MPIU_Object_alloc_t MPID_Grequest_class_mem; 72 extern int MPIR_Grequest_registered_finalizer; 73 extern MPID_Grequest_class *MPIR_Grequest_class_list; 45 74 #endif 46 75 … … 226 255 MPIU_Object_set_ref(class_ptr, 1); 227 256 257 if (MPIR_Grequest_class_list == NULL) { 258 class_ptr->next = NULL; 259 } 260 else { 261 class_ptr->next = MPIR_Grequest_class_list; 262 } 263 MPIR_Grequest_class_list = class_ptr; 264 if (!MPIR_Grequest_registered_finalizer) { 265 /* must run before (w/ higher priority than) the handle check 266 * finalizer in order avoid being flagged as a leak */ 267 MPIR_Add_finalize(&MPIR_Grequest_free_classes_on_finalize, 268 NULL, 269 MPIR_FINALIZE_CALLBACK_HANDLE_CHECK_PRIO+1); 270 MPIR_Grequest_registered_finalizer = 1; 271 } 272 228 273 /* ... end of body of routine ... */ 229 274 fn_exit: -
mpich2/trunk/src/util/mem/handlemem.c
r5524 r5665 354 354 the priority of the callback that frees the objmem direct and 355 355 indirect storage. */ 356 MPIR_Add_finalize(MPIU_CheckHandlesOnFinalize, objmem, 1);356 MPIR_Add_finalize(MPIU_CheckHandlesOnFinalize, objmem, MPIR_FINALIZE_CALLBACK_HANDLE_CHECK_PRIO); 357 357 #endif 358 358 /* ptr points to object to allocate */
