summaryrefslogtreecommitdiffstats
path: root/test/test.c
diff options
context:
space:
mode:
authorJohn Stebbins <[email protected]>2016-05-05 11:39:15 -0600
committerJohn Stebbins <[email protected]>2016-05-05 11:41:27 -0600
commit830ef047a4e7b9053140d619bcdf9eafbd869c0b (patch)
tree11b3072a94fde6944965d463cb74c43fdd2538b5 /test/test.c
parent128b7fdd96cf8082d47ec349923048c73d9a1d4b (diff)
cli: fix race during queue processing
during queue processing, the pre-scan of an encode could trigger an attempt to encode using command line options, which would fail and abort the queue
Diffstat (limited to 'test/test.c')
-rw-r--r--test/test.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/test.c b/test/test.c
index 2c728d960..8e58fa9e3 100644
--- a/test/test.c
+++ b/test/test.c
@@ -260,6 +260,8 @@ static int get_argv_utf8(int *argc_ptr, char ***argv_ptr)
#endif
}
+static volatile int job_running = 0;
+
void EventLoop(hb_handle_t *h, hb_dict_t *preset_dict)
{
/* Wait... */
@@ -351,6 +353,7 @@ void EventLoop(hb_handle_t *h, hb_dict_t *preset_dict)
HandleEvents( h, preset_dict );
}
+ job_running = 0;
}
int RunQueueJob(hb_handle_t *h, hb_dict_t *job_dict)
@@ -371,6 +374,7 @@ int RunQueueJob(hb_handle_t *h, hb_dict_t *job_dict)
hb_add_json(h, json_job);
free(json_job);
+ job_running = 1;
hb_start( h );
EventLoop(h, NULL);
@@ -787,6 +791,11 @@ static int HandleEvents(hb_handle_t * h, hb_dict_t *preset_dict)
hb_title_set_t * title_set;
hb_title_t * title;
+ if (job_running)
+ {
+ // SCANDONE generated by a scan during execution of the job
+ break;
+ }
title_set = hb_get_title_set( h );
if( !title_set || !hb_list_count( title_set->list_title ) )
{
@@ -877,6 +886,7 @@ static int HandleEvents(hb_handle_t * h, hb_dict_t *preset_dict)
hb_add_json(h, json_job);
free(json_job);
+ job_running = 1;
hb_start( h );
break;
}
@@ -936,6 +946,7 @@ static int HandleEvents(hb_handle_t * h, hb_dict_t *preset_dict)
}
done_error = p.error;
work_done = 1;
+ job_running = 0;
break;
#undef p
}