g_mutex_lock(item->lock);
bluesky_cloudlog_stats_update(item, -1);
item->pending_write &= ~CLOUDLOG_JOURNAL;
- item->location_flags |= CLOUDLOG_JOURNAL;
+ item->location_flags
+ = (item->location_flags & ~CLOUDLOG_UNCOMMITTED) | CLOUDLOG_JOURNAL;
bluesky_cloudlog_stats_update(item, 1);
g_cond_signal(item->cond);
g_mutex_unlock(item->lock);
void bluesky_log_item_submit(BlueSkyCloudLog *item, BlueSkyLog *log)
{
- bluesky_cloudlog_ref(item);
- g_atomic_int_add(&item->data_lock_count, 1);
- g_async_queue_push(log->queue, item);
+ if (!(item->location_flags & CLOUDLOG_JOURNAL)) {
+ bluesky_cloudlog_ref(item);
+ item->location_flags |= CLOUDLOG_UNCOMMITTED;
+ g_atomic_int_add(&item->data_lock_count, 1);
+ g_async_queue_push(log->queue, item);
+ }
}
void bluesky_log_finish_all(GList *log_items)
BlueSkyCloudLog *item = (BlueSkyCloudLog *)log_items->data;
g_mutex_lock(item->lock);
- while ((item->pending_write & CLOUDLOG_JOURNAL))
+ while ((item->location_flags & CLOUDLOG_UNCOMMITTED))
g_cond_wait(item->cond, item->lock);
g_mutex_unlock(item->lock);
bluesky_cloudlog_unref(item);