diff options
author | Sakari Bergen <sakari.bergen@beatwaves.net> | 2012-01-23 18:54:13 +0000 |
---|---|---|
committer | Sakari Bergen <sakari.bergen@beatwaves.net> | 2012-01-23 18:54:13 +0000 |
commit | 0bede516beebc906460933094e4722fcb68b5aa0 (patch) | |
tree | cda3637c994d313bffab0b7f12d3672255daab87 /libs/audiographer | |
parent | a71172feb2af77d88f77ae26c9cfd0052540ef4b (diff) |
Fix export threading timeouts when disk operations take long. Might fix other timeout issues also.
git-svn-id: svn://localhost/ardour2/branches/3.0@11317 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/audiographer')
-rw-r--r-- | libs/audiographer/audiographer/general/threader.h | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/libs/audiographer/audiographer/general/threader.h b/libs/audiographer/audiographer/general/threader.h index e5a4e744cc..0f4aaff973 100644 --- a/libs/audiographer/audiographer/general/threader.h +++ b/libs/audiographer/audiographer/general/threader.h @@ -43,7 +43,7 @@ class Threader : public Source<T>, public Sink<T> * \param thread_pool a thread pool from which all tasks are scheduled * \param wait_timeout_milliseconds maximum time allowed for threads to use in processing */ - Threader (Glib::ThreadPool & thread_pool, long wait_timeout_milliseconds = 1000) + Threader (Glib::ThreadPool & thread_pool, long wait_timeout_milliseconds = 500) : thread_pool (thread_pool) , readers (0) , wait_timeout (wait_timeout_milliseconds) @@ -85,14 +85,15 @@ class Threader : public Source<T>, public Sink<T> void wait() { - Glib::TimeVal wait_time; - wait_time.assign_current_time(); - wait_time.add_milliseconds(wait_timeout); + while (g_atomic_int_get (&readers) != 0) { + Glib::TimeVal wait_time; + wait_time.assign_current_time(); + wait_time.add_milliseconds(wait_timeout); - wait_cond.timed_wait(wait_mutex, wait_time); - bool timed_out = (g_atomic_int_get (&readers) != 0); + wait_cond.timed_wait(wait_mutex, wait_time); + } + wait_mutex.unlock(); - if (timed_out) { throw Exception (*this, "wait timed out"); } if (exception) { throw *exception; @@ -130,4 +131,4 @@ class Threader : public Source<T>, public Sink<T> } // namespace -#endif //AUDIOGRAPHER_THREADER_H
\ No newline at end of file +#endif //AUDIOGRAPHER_THREADER_H |