Commit f12cc0f9 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Be even more paranoid about the condvar used for the timeout.



git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@4509 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent 5bc21e19
...@@ -482,7 +482,9 @@ exec_file_thread(void *priv) ...@@ -482,7 +482,9 @@ exec_file_thread(void *priv)
vtc_log(vltop, 1, "RESETTING after %s", pe->fn); vtc_log(vltop, 1, "RESETTING after %s", pe->fn);
reset_cmds(cmds); reset_cmds(cmds);
vtc_error = old_err; vtc_error = old_err;
AZ(pthread_mutex_lock(&vtc_mtx));
AZ(pthread_cond_signal(&vtc_cond)); AZ(pthread_cond_signal(&vtc_cond));
AZ(pthread_mutex_unlock(&vtc_mtx));
return (NULL); return (NULL);
} }
...@@ -507,12 +509,14 @@ exec_file(const char *fn, unsigned dur) ...@@ -507,12 +509,14 @@ exec_file(const char *fn, unsigned dur)
fn, strerror(errno)); fn, strerror(errno));
pe.fn = fn; pe.fn = fn;
AZ(pthread_create(&pt, NULL, exec_file_thread, &pe));
AZ(pthread_mutex_lock(&vtc_mtx));
AZ(clock_gettime(CLOCK_REALTIME, &ts)); AZ(clock_gettime(CLOCK_REALTIME, &ts));
ts.tv_sec += dur; ts.tv_sec += dur;
AZ(pthread_mutex_lock(&vtc_mtx));
AZ(pthread_create(&pt, NULL, exec_file_thread, &pe));
i = pthread_cond_timedwait(&vtc_cond, &vtc_mtx, &ts); i = pthread_cond_timedwait(&vtc_cond, &vtc_mtx, &ts);
AZ(pthread_mutex_unlock(&vtc_mtx)); AZ(pthread_mutex_unlock(&vtc_mtx));
if (i == ETIMEDOUT) { if (i == ETIMEDOUT) {
vtc_log(vltop, 1, "Test timed out"); vtc_log(vltop, 1, "Test timed out");
vtc_error = 1; vtc_error = 1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment