X-Git-Url: http://git.vrable.net/?a=blobdiff_plain;f=bluesky%2Fstore.c;h=5cc475efcdbd2dc7c8ae0a08cc4b947a5f0641cb;hb=a82b60b3b683840a7074110831bcbaa16a40f0eb;hp=427112ba351f359387f4c9b1a8e15b32d5dafd3b;hpb=ea7099e8f1f6319cf6d20087d71209fa79cecf6f;p=bluesky.git diff --git a/bluesky/store.c b/bluesky/store.c index 427112b..5cc475e 100644 --- a/bluesky/store.c +++ b/bluesky/store.c @@ -292,13 +292,15 @@ void bluesky_store_add_barrier(BlueSkyStoreAsync *barrier, g_mutex_unlock(barrier->lock); g_mutex_lock(async->lock); - if (async->barrier == NULL) { + if (async->barrier == NULL && async->status != ASYNC_COMPLETE) { async->barrier = barrier; + g_mutex_unlock(async->lock); } else { - g_warning("Adding async to more than one barrier!\n"); + if (async->barrier != NULL) + g_warning("Adding async to more than one barrier!\n"); + g_mutex_unlock(async->lock); bluesky_store_async_add_notifier(async, op_complete, barrier); } - g_mutex_unlock(async->lock); } static void notifier_task(gpointer n, gpointer s) @@ -499,6 +501,32 @@ static BlueSkyStoreImplementation filestore_impl = { .cleanup = filestore_cleanup, }; +/* A store implementation which simply discards all data, for testing. */ +static gpointer nullstore_create(const gchar *path) +{ + return (gpointer)nullstore_create; +} + +static void nullstore_destroy(gpointer store) +{ +} + +static void nullstore_submit(gpointer s, BlueSkyStoreAsync *async) +{ + bluesky_store_async_mark_complete(async); +} + +static void nullstore_cleanup(gpointer store, BlueSkyStoreAsync *async) +{ +} + +static BlueSkyStoreImplementation nullstore_impl = { + .create = nullstore_create, + .destroy = nullstore_destroy, + .submit = nullstore_submit, + .cleanup = nullstore_cleanup, +}; + void bluesky_store_init() { store_implementations = g_hash_table_new(g_str_hash, g_str_equal); @@ -506,4 +534,5 @@ void bluesky_store_init() bluesky_max_threads, FALSE, NULL); bluesky_store_register(&memstore_impl, "mem"); bluesky_store_register(&filestore_impl, "file"); + bluesky_store_register(&nullstore_impl, "null"); }