void myqtt_ctx_unref2 ( MyQttCtx **  ctx,
const char *  who 

Decrease reference count and nullify caller's pointer in the case the count reaches 0.

ctxThe context to decrement reference count. In the case 0 is reached the MyQttCtx instance is deallocated and the callers reference is nullified.
whoAn string that identifies this ref. Useful for debuging.

References myqtt_ctx_free2(), myqtt_mutex_lock(), and myqtt_mutex_unlock().

Referenced by myqtt_conn_free(), and myqtt_ctx_unref().