Add reference counting to asynchronous storage operations.
[bluesky.git] / bluesky / s3store.c
index 5ab42e1..bf7c7cd 100644 (file)
@@ -138,10 +138,9 @@ static void s3store_task(gpointer a, gpointer s)
         async->result = 0;
     }
 
-    // TODO: Deallocate resources
-
     g_print("Finish task...\n");
     bluesky_store_async_mark_complete(async);
+    bluesky_store_async_unref(async);
 }
 
 static gpointer s3store_new()
@@ -184,6 +183,7 @@ static void s3store_submit(gpointer s, BlueSkyStoreAsync *async)
     case STORE_OP_GET:
     case STORE_OP_PUT:
         async->status = ASYNC_PENDING;
+        bluesky_store_async_ref(async);
         g_thread_pool_push(store->thread_pool, async, NULL);
         break;