static struct fuse_chan *channel;
static GAsyncQueue *async_queue;
static gint stop_or_error = TZIP_RUNNING_STATE;
+
+static int thread_ready;
static pthread_cond_t thread_cond = PTHREAD_COND_INITIALIZER;
static pthread_mutex_t thread_cond_mutex = PTHREAD_MUTEX_INITIALIZER;
/* notify to tzip_mount_thread */
pthread_mutex_lock(&thread_cond_mutex);
+ thread_ready = 1;
pthread_cond_signal(&thread_cond);
pthread_mutex_unlock(&thread_cond_mutex);
/* notify to tzip_mount_thread */
pthread_mutex_lock(&thread_cond_mutex);
+ thread_ready = 1;
pthread_cond_signal(&thread_cond);
pthread_mutex_unlock(&thread_cond_mutex);
/* wait for tzip_thread to be ready*/
pthread_mutex_lock(&thread_cond_mutex);
- pthread_cond_wait(&thread_cond, &thread_cond_mutex);
+ if (!thread_ready)
+ pthread_cond_wait(&thread_cond, &thread_cond_mutex);
+ assert(thread_ready); /* Never happend */
pthread_mutex_unlock(&thread_cond_mutex);
while (1) {