[Openib-windows] [PATCH] Remove support for recursive CL_INIT/CL_DEINIT
Fab Tillier
ftillier at silverstorm.com
Mon Sep 19 00:00:16 PDT 2005
Now that IPoIB only calls CL_INIT/DEINIT once rather than per instance, I have
removed support for recursive CL_INIT/DEINIT calls. I also added a line to
clear the gp_mem_tracker pointer after destruction as pointed out by Tzachi.
This is committed in revision 72.
- Fab
Signed-off-by: Fab Tillier (ftillier at silverstorm.com)
Index: core/complib/cl_memory.c
===================================================================
--- core/complib/cl_memory.c (revision 64)
+++ core/complib/cl_memory.c (working copy)
@@ -42,11 +42,9 @@
#include "cl_memtrack.h"
-#include <complib/cl_atomic.h>
cl_mem_tracker_t *gp_mem_tracker = NULL;
-atomic32_t g_mem_trk_ref = 0;
/*
@@ -75,10 +73,7 @@
cl_status_t status;
if( gp_mem_tracker )
- {
- cl_atomic_inc( &g_mem_trk_ref );
return;
- }
/* Allocate the memory tracker object. */
gp_mem_tracker = (cl_mem_tracker_t*)
@@ -100,8 +95,6 @@
return;
}
- cl_atomic_inc( &g_mem_trk_ref );
-
cl_msg_out( "\n\n\n*** Memory tracker object address = %p ***\n\n\n",
gp_mem_tracker );
}
@@ -119,9 +112,6 @@
if( !gp_mem_tracker )
return;
- if( cl_atomic_dec( &g_mem_trk_ref ) )
- return;
-
if( cl_qmap_count( &gp_mem_tracker->alloc_map ) )
{
/* There are still items in the list. Print them out. */
@@ -151,6 +141,7 @@
/* Free the memory allocated for the memory tracker object. */
__cl_free_priv( gp_mem_tracker );
+ gp_mem_tracker = NULL;
}
Index: core/complib/cl_obj.c
===================================================================
--- core/complib/cl_obj.c (revision 64)
+++ core/complib/cl_obj.c (working copy)
@@ -43,7 +43,6 @@
/* The global object manager. */
cl_obj_mgr_t *gp_obj_mgr = NULL;
-atomic32_t g_cl_obj_ref = 0;
@@ -58,10 +57,7 @@
/* See if the object manager has already been created. */
if( gp_obj_mgr )
- {
- cl_atomic_inc( &g_cl_obj_ref );
return CL_SUCCESS;
- }
/* Allocate the object manager. */
gp_obj_mgr = cl_zalloc( sizeof( cl_obj_mgr_t ) );
@@ -74,8 +70,6 @@
cl_async_proc_construct( &gp_obj_mgr->async_proc_mgr );
cl_qpool_construct( &gp_obj_mgr->rel_pool );
- cl_atomic_inc( &g_cl_obj_ref );
-
/* Initialize the spinlock. */
status = cl_spinlock_init( &gp_obj_mgr->lock );
if( status != CL_SUCCESS )
@@ -116,10 +110,6 @@
if( !gp_obj_mgr )
return;
- /* See if this is the last call. */
- if( cl_atomic_dec( &g_cl_obj_ref ) )
- return;
-
/* Verify that all object's have been destroyed. */
for( p_list_item = cl_qlist_head( &gp_obj_mgr->obj_list );
p_list_item != cl_qlist_end( &gp_obj_mgr->obj_list );
More information about the ofw
mailing list