Comment 1 for bug 567402

Revision history for this message
Paul McCullagh (paul-mccullagh) wrote :

The problem with this function:

xtPublic void xt_ind_release_handle(XTIndHandlePtr handle, xtBool have_lock, XTThreadPtr thread)

is that 'thread' is not used if atomic ops are not used(i.e. if the global XT_NO_ATOMICS is defined).

In cache_xt.cc, we see:

#ifdef XT_NO_ATOMICS
#define IDX_CAC_USE_PTHREAD_RW
#else
//#define IDX_CAC_USE_PTHREAD_RW
#define IDX_CAC_USE_XSMUTEX
//#define IDX_USE_SPINXSLOCK
#endif

#if defined(IDX_CAC_USE_PTHREAD_RW)
#define IDX_CAC_LOCK_TYPE xt_rwlock_type
#define IDX_CAC_INIT_LOCK(s, i) xt_init_rwlock_with_autoname(s, &(i)->cs_lock)
#define IDX_CAC_FREE_LOCK(s, i) xt_free_rwlock(&(i)->cs_lock)
#define IDX_CAC_READ_LOCK(i, o) xt_slock_rwlock_ns(&(i)->cs_lock)
#define IDX_CAC_WRITE_LOCK(i, o) xt_xlock_rwlock_ns(&(i)->cs_lock)
#define IDX_CAC_UNLOCK(i, o) xt_unlock_rwlock_ns(&(i)->cs_lock)
#elif defined(IDX_CAC_USE_XSMUTEX)
....

So the macro IDX_CAC_READ_LOCK(i, o) ignores the thread parameter (o) in the case of XT_NO_ATOMICS.

So the solution may be as follows:

#define IDX_CAC_READ_LOCK(i, o) xt_slock_rwlock_ns(&(i)->cs_lock); (void) (o);

or even better:

#define IDX_CAC_READ_LOCK(i, o) do { xt_slock_rwlock_ns(&(i)->cs_lock); (void) (o); } where (0)

This should also solve the second warning: plugin/pbxt/src/cache_xt.cc:829: error: unused parameter ‘ot’