[COMPLIB] Wait indefinitely for references to be released during synchronous
authorftillier <ftillier@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Thu, 6 Jul 2006 14:56:21 +0000 (14:56 +0000)
committerftillier <ftillier@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Thu, 6 Jul 2006 14:56:21 +0000 (14:56 +0000)
object destruction.

git-svn-id: svn://openib.tc.cornell.edu/gen1/trunk@407 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

core/complib/cl_obj.c

index d07c8f9..191ef02 100644 (file)
@@ -685,7 +685,19 @@ __destroy_obj(
                if( ref_cnt )\r
                {\r
                        /* Wait for all other references to go away. */\r
-                       cl_event_wait_on( &p_obj->event, 10000000, FALSE );\r
+#if DBG\r
+                       /*\r
+                        * In debug builds, we assert every 10 seconds - a synchronous\r
+                        * destruction should not take that long.\r
+                        */\r
+                       while( cl_event_wait_on( &p_obj->event, 10000000, FALSE ) ==\r
+                               CL_TIMEOUT )\r
+                       {\r
+                               CL_ASSERT( !ref_cnt );\r
+                       }\r
+#else  /* DBG */\r
+                       cl_event_wait_on( &p_obj->event, EVENT_NO_TIMEOUT, FALSE );\r
+#endif /* DBG */\r
                }\r
                __destroy_cb( &p_obj->async_item );\r
        }\r