9 #ifndef __SGREFERENCED_DATA_H__
10 #define __SGREFERENCED_DATA_H__
42 PTHREAD_LOCK_INIT(&m_refcount->lock);
50 : m_refcount(orig.m_refcount)
83 if (m_refcount == NULL)
87 PTHREAD_LOCK(&m_refcount->lock);
89 int32_t c = m_refcount->
rc;
91 PTHREAD_UNLOCK(&m_refcount->lock);
95 SG_SGCDEBUG(
"ref_count(): refcount %d, data %p\n", c,
this);
104 m_refcount=orig.m_refcount;
113 if (m_refcount == NULL)
119 PTHREAD_LOCK(&m_refcount->lock);
121 int32_t c = ++(m_refcount->
rc);
123 PTHREAD_UNLOCK(&m_refcount->lock);
125 #ifdef DEBUG_SGVECTOR
126 SG_SGCDEBUG(
"ref() refcount %ld data %p increased\n", c,
this);
138 if (m_refcount == NULL)
146 PTHREAD_LOCK(&m_refcount->lock);
148 int32_t c = --(m_refcount->
rc);
150 PTHREAD_UNLOCK(&m_refcount->lock);
154 #ifdef DEBUG_SGVECTOR
155 SG_SGCDEBUG(
"unref() refcount %d data %p destroying\n", c,
this);
159 PTHREAD_LOCK_DESTROY(&m_refcount->lock);
167 #ifdef DEBUG_SGVECTOR
168 SG_SGCDEBUG(
"unref() refcount %d data %p decreased\n", c,
this);
191 #endif // __SGREFERENCED_DATA_H__