X-Git-Url: http://git.vrable.net/?a=blobdiff_plain;f=bluesky%2Fstore.c;h=022deeb0ca2d4f8775b4a58a227128a086b3e5f4;hb=a5b5871865301712bc22ffc3d86a425dc0b45991;hp=cc8a5e4597481e958c22dfae0947ade1d0e8b80f;hpb=625d4ed1c01e01a5f2a508264f8605fb79a620fb;p=bluesky.git diff --git a/bluesky/store.c b/bluesky/store.c index cc8a5e4..022deeb 100644 --- a/bluesky/store.c +++ b/bluesky/store.c @@ -110,7 +110,8 @@ void bluesky_store_async_unref(BlueSkyStoreAsync *async) g_free(async->key); bluesky_string_unref(async->data); g_free(async); - g_print("Freed async\n"); + g_log("bluesky/store", G_LOG_LEVEL_DEBUG, + "freeing async"); } } @@ -173,29 +174,29 @@ void bluesky_store_async_mark_complete(BlueSkyStoreAsync *async) } } -static void test_notifier(gpointer a, gpointer u) -{ - g_print("Notifier called!\n"); -} - void bluesky_store_async_submit(BlueSkyStoreAsync *async) { BlueSkyStore *store = async->store; /* Barriers are handled specially, and not handed down the storage * implementation layer. */ - if (async->op = STORE_OP_BARRIER) { + if (async->op == STORE_OP_BARRIER) { async->status = ASYNC_RUNNING; if (GPOINTER_TO_INT(async->store_private) == 0) bluesky_store_async_mark_complete(async); return; } + g_log("bluesky/store", G_LOG_LEVEL_DEBUG, "submit: %s %s", + async->op == STORE_OP_GET ? "GET" + : async->op == STORE_OP_PUT ? "PUT" + : async->op == STORE_OP_DELETE ? "DELETE" : "???", + async->key); + g_mutex_lock(async->store->lock); async->store->pending++; g_mutex_unlock(async->store->lock); - bluesky_store_async_add_notifier(async, test_notifier, NULL); store->impl->submit(store->handle, async); if (bluesky_options.synchronous_stores) @@ -204,7 +205,6 @@ void bluesky_store_async_submit(BlueSkyStoreAsync *async) static void op_complete(gpointer a, gpointer b) { - BlueSkyStoreAsync *async = (BlueSkyStoreAsync *)a; BlueSkyStoreAsync *barrier = (BlueSkyStoreAsync *)b; g_mutex_lock(barrier->lock); @@ -225,7 +225,7 @@ void bluesky_store_add_barrier(BlueSkyStoreAsync *barrier, g_return_if_fail(barrier->op == STORE_OP_BARRIER); barrier->store_private = GINT_TO_POINTER(GPOINTER_TO_INT(barrier->store_private) + 1); - bluesky_store_async_add_notifier(async, op_complete, NULL); + bluesky_store_async_add_notifier(async, op_complete, barrier); } static void notifier_task(gpointer n, gpointer s)