#if HAVE_CONFIG_H
#include <config.h>
#endif
-#include <pthread.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
yaz_mutex_enter(g_mutex);
no_clients += delta;
yaz_mutex_leave(g_mutex);
- yaz_log(YLOG_LOG, "%s clients=%d", delta > 0 ? "INC" : "DEC", no_clients);
+ yaz_log(YLOG_DEBUG, "%s clients=%d", delta > 0 ? "INC" : "DEC", no_clients);
}
#else
#define client_use(x)
void client_got_records(struct client *cl)
{
- if (cl->session)
+ struct session *se = cl->session;
+ if (se)
{
- session_alert_watch(cl->session, SESSION_WATCH_SHOW);
- session_alert_watch(cl->session, SESSION_WATCH_RECORD);
+ client_unlock(cl);
+ session_alert_watch(se, SESSION_WATCH_SHOW);
+ session_alert_watch(se, SESSION_WATCH_RECORD);
+ client_lock(cl);
}
}
return r;
}
+void client_lock(struct client *c)
+{
+ yaz_mutex_enter(c->mutex);
+}
+
+void client_unlock(struct client *c)
+{
+ yaz_mutex_leave(c->mutex);
+}
+
void client_incref(struct client *c)
{
pazpar2_incref(&c->ref_count, c->mutex);
- yaz_log(YLOG_LOG, "client_incref c=%p %s cnt=%d",
+ yaz_log(YLOG_DEBUG, "client_incref c=%p %s cnt=%d",
c, client_get_url(c), c->ref_count);
}
{
if (c)
{
- yaz_log(YLOG_LOG, "client_destroy c=%p %s cnt=%d",
+ yaz_log(YLOG_DEBUG, "client_destroy c=%p %s cnt=%d",
c, client_get_url(c), c->ref_count);
if (!pazpar2_decref(&c->ref_count, c->mutex))
{