16
16
* Copyright (c) 2012-2015 Los Alamos National Security, LLC. All rights
17
17
* reserved.
18
18
* Copyright (c) 2013-2015 NVIDIA Corporation. All rights reserved.
19
- * Copyright (c) 2014-2015 Intel, Inc. All rights reserved.
19
+ * Copyright (c) 2014-2016 Intel, Inc. All rights reserved.
20
20
* Copyright (c) 2014-2015 Research Organization for Information Science
21
21
* and Technology (RIST). All rights reserved.
22
22
* $COPYRIGHT$
@@ -387,8 +387,7 @@ static int mca_btl_tcp_component_open(void)
387
387
388
388
static int mca_btl_tcp_component_close (void )
389
389
{
390
- opal_list_item_t * item ;
391
- opal_list_item_t * next ;
390
+ mca_btl_tcp_event_t * event , * next ;
392
391
393
392
if (NULL != mca_btl_tcp_component .tcp_btls ) {
394
393
free (mca_btl_tcp_component .tcp_btls );
@@ -407,17 +406,12 @@ static int mca_btl_tcp_component_close(void)
407
406
}
408
407
#endif
409
408
410
- /* cleanup any pending events */
411
- MCA_BTL_TCP_CRITICAL_SECTION_ENTER (& mca_btl_tcp_component .tcp_lock );
412
- for (item = opal_list_get_first (& mca_btl_tcp_component .tcp_events );
413
- item != opal_list_get_end (& mca_btl_tcp_component .tcp_events );
414
- item = next ) {
415
- mca_btl_tcp_event_t * event = (mca_btl_tcp_event_t * )item ;
416
- next = opal_list_get_next (item );
417
- opal_event_del (& event -> event );
418
- OBJ_RELEASE (event );
419
- }
420
- MCA_BTL_TCP_CRITICAL_SECTION_LEAVE (& mca_btl_tcp_component .tcp_lock );
409
+ /* remove all pending events. Do not lock the tcp_events list as
410
+ * the event themselves will unregister during the destructor. */
411
+ OPAL_LIST_FOREACH_SAFE (event , next , & mca_btl_tcp_component .tcp_events , mca_btl_tcp_event_t ) {
412
+ opal_event_del (& event -> event );
413
+ OBJ_RELEASE (event );
414
+ }
421
415
422
416
/* release resources */
423
417
OBJ_DESTRUCT (& mca_btl_tcp_component .tcp_procs );
0 commit comments