From 755dcb223e9ca2aecd2555a417247d8f55fdaf33 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Thu, 28 Nov 2024 20:54:20 -0500 Subject: fixes #1408 Reference count as a first class type This starts by using this for the nni_pipe, but we will use it for the other primary objects as well. This should simplify the tear down and hopefully eliminate some races. It does mean that pipe destruction goes through an additional context switch, for now at least. This shouldn't be on the hot data path anyway. --- src/core/sockimpl.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/core/sockimpl.h') diff --git a/src/core/sockimpl.h b/src/core/sockimpl.h index 45135976..801ef7b1 100644 --- a/src/core/sockimpl.h +++ b/src/core/sockimpl.h @@ -105,9 +105,8 @@ struct nni_pipe { nni_atomic_bool p_closed; nni_atomic_flag p_stop; bool p_cbs; - int p_ref; - nni_cv p_cv; nni_reap_node p_reap; + nni_refcnt p_refcnt; #ifdef NNG_ENABLE_STATS nni_stat_item st_root; -- cgit v1.2.3-70-g09d2