On Mon, Oct 6, 2008 at 11:12 AM, Vladislav Vaintroub <wlad@stripped> wrote:
>> The advantage of targeted reference counting is performance.
>> The advantage of smart pointers is stability.
>
> I'm about to give up. All discussions during Boston meeting are in vain.
> References are non-existent feature of C++ and it is not possible to prevent
> copying and object when it is passed as function parameter. Therefore smart
> pointers are slow.
I am not sure if this is what you want to do, but you can prevent
objects from being copied. Mutex_sentry from sql/log.cc does just
that.
class Mutex_sentry {
public:
Mutex_sentry(pthread_mutex_t *mutex) : m_mutex(mutex) {
if (m_mutex) pthread_mutex_lock(mutex);
}
~Mutex_sentry() {
if (m_mutex) pthread_mutex_unlock(m_mutex);
#ifndef DBUG_OFF
m_mutex= 0;
#endif
}
private:
pthread_mutex_t *m_mutex;
// It's not allowed to copy this object in any way
Mutex_sentry(Mutex_sentry const&);
void operator=(Mutex_sentry const&);
};
>
>> From: Kevin.Lewis@stripped [mailto:Kevin.Lewis@stripped]
>> Sent: Monday, October 06, 2008 7:07 PM
>> To: falcon@stripped
>> Subject: Understanding RefCounts in Falcon
>
>
>
> --
> Falcon Storage Engine Mailing List
> For list archives: http://lists.mysql.com/falcon
> To unsubscribe: http://lists.mysql.com/falcon?unsub=1
>
>
--
Mark Callaghan
mdcallag@stripped