summary |
shortlog |
log |
commit | commitdiff |
review |
tree
raw |
patch |
inline | side by side (from parent 1:
45a4e69)
A queued job must be treated. It was not the case
when the job was queued from a foreign thread.
This change detect that a potential hang exists
and wake up an event loop to avoid it.
Bug-AGL: SPEC-2809
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
Change-Id: Id12d32771ea37df5f5f2e208ec9645a6c4b0d0ab
enum start_mode start_mode)
{
struct job *job;
enum start_mode start_mode)
{
struct job *job;
pthread_mutex_lock(&mutex);
pthread_mutex_lock(&mutex);
goto error;
/* start a thread if needed */
goto error;
/* start a thread if needed */
+ busy = busy_thread_count == started_thread_count;
if (start_mode != Start_Lazy
if (start_mode != Start_Lazy
- && busy_thread_count == started_thread_count
&& (start_mode == Start_Urgent || remaining_job_count + started_thread_count < allowed_job_count)
&& started_thread_count < allowed_thread_count) {
/* all threads are busy and a new can be started */
&& (start_mode == Start_Urgent || remaining_job_count + started_thread_count < allowed_job_count)
&& started_thread_count < allowed_thread_count) {
/* all threads are busy and a new can be started */
ERROR("can't start initial thread: %m");
goto error2;
}
ERROR("can't start initial thread: %m");
goto error2;
}
}
/* queues the job */
job_add(job);
}
/* queues the job */
job_add(job);
+ /* wakeup an evloop if needed */
+ if (busy)
+ evloop_wakeup();
+
/* signal an existing job */
pthread_cond_signal(&cond);
pthread_mutex_unlock(&mutex);
/* signal an existing job */
pthread_cond_signal(&cond);
pthread_mutex_unlock(&mutex);