Subj : Re: A question about atomic_ptr To : comp.programming.threads From : Chris Thomasson Date : Sun Apr 17 2005 02:34 am I needed to tweak it in order to handle the static storage bit correctly. Here is the hack: > static void AC_CDECL lfgc_dtor( void *s ) > { > ac_cpu_node_t *node = (ac_cpu_node_t*)s; > delete (sp_counted_base*)node->state; > ac_thread_cpu_node_cache_push( ac_thread_self(), node ); > } Needs to be: static void AC_CDECL lfgc_dtor( void *s ) { ac_cpu_node_t *node = (ac_cpu_node_t*)s; delete (sp_counted_base*)node->state; if ( node->next == (ac_cpu_node_t*)0x00000001 ) { node->fp_dtor = (ac_fp_dtor_t)0x00000001; } ac_thread_cpu_node_cache_push( ac_thread_self(), node ); } > void init( sp_counted_base *_base ) > { > m_node = ac_thread_cpu_node_cache_pop > ( ac_thread_self(), > _base ); > } Needs to be: void init( sp_counted_base *_base ) { m_node = ac_thread_cpu_node_cache_pop( ac_thread_self(), _base ); if ( m_node->fp_dtor == (ac_fp_dtor_t)0x00000001 ) { m_node->next = (ac_cpu_node_t*)0x00000001; } } So far it looks like this may work! I will tinker around with it some more and report back soon. I should really post full modified boost sources... Humm... ;) .