Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Use timed pop to avoid deadlock on unmount

  • Loading branch information...
commit a387205da22bb61a618a730c575425fc0514adfa 1 parent 4b763df
@paulcbetts authored
Showing with 10 additions and 2 deletions.
  1. +10 −2 src/vcachefs.c
View
12 src/vcachefs.c
@@ -179,8 +179,15 @@ static gpointer file_cache_copy_thread(gpointer data)
while(g_atomic_int_get(&mount_obj->quitflag_atomic) == 0) {
int err, destfd;
struct stat st;
- char* relative_path = g_async_queue_pop(mount_obj->file_copy_queue);
struct cache_entry ce;
+ GTimeVal five_secs_from_now;
+ char* relative_path;
+
+ g_get_current_time(&five_secs_from_now);
+ g_time_val_add(&five_secs_from_now, 5 * 1000 * 1000);
+ relative_path = g_async_queue_pop(mount_obj->file_copy_queue);
+ if (!relative_path)
+ continue;
/* Create the parent directory if we have to */
char* dirname = g_path_get_dirname(relative_path);
@@ -263,7 +270,8 @@ static void vcachefs_destroy(void *mount_object_ptr)
char* item;
g_async_queue_lock(mount_object->file_copy_queue);
while ( (item = g_async_queue_try_pop_unlocked(mount_object->file_copy_queue)) ) {
- g_free(item);
+ if (item)
+ g_free(item);
}
g_async_queue_unref(mount_object->file_copy_queue);
Please sign in to comment.
Something went wrong with that request. Please try again.