Browse Source

Grab the caller of dec_instance_ref for debugging

master
Con Kolivas 10 years ago
parent
commit
c68b30c08e
  1. 18
      src/stratifier.c

18
src/stratifier.c

@ -1104,25 +1104,19 @@ static stratum_instance_t *ref_instance_by_id(sdata_t *sdata, int64_t id)
} }
/* Decrease the reference count of instance. */ /* Decrease the reference count of instance. */
static void ___dec_instance_ref(stratum_instance_t *instance, const char *file, const char *func, static void _dec_instance_ref(sdata_t *sdata, stratum_instance_t *instance, const char *file,
const int line) const char *func, const int line)
{ {
instance->ref--; ck_wlock(&sdata->instance_lock);
if (unlikely(instance->ref < 0)) { if (unlikely(--instance->ref < 0)) {
LOGERR("Instance ref count dropped below zero from %s %s:%d", file, func, line); LOGERR("Instance ref count dropped below zero from %s %s:%d", file, func, line);
instance->ref = 0; instance->ref = 0;
} }
}
#define __dec_instance_ref(instance) ___dec_instance_ref(instance, __FILE__, __func__, __LINE__)
static void dec_instance_ref(sdata_t *sdata, stratum_instance_t *instance)
{
ck_wlock(&sdata->instance_lock);
__dec_instance_ref(instance);
ck_wunlock(&sdata->instance_lock); ck_wunlock(&sdata->instance_lock);
} }
#define dec_instance_ref(sdata, instance) _dec_instance_ref(sdata, instance, __FILE__, __func__, __LINE__)
/* Enter with write instance_lock held */ /* Enter with write instance_lock held */
static stratum_instance_t *__stratum_add_instance(ckpool_t *ckp, int64_t id, int server) static stratum_instance_t *__stratum_add_instance(ckpool_t *ckp, int64_t id, int server)
{ {

Loading…
Cancel
Save