summaryrefslogtreecommitdiff
path: root/jackd/clientengine.c
diff options
context:
space:
mode:
authortorben <torben@0c269be4-1314-0410-8aa9-9f06e86f4224>2011-05-29 00:47:11 +0000
committertorben <torben@0c269be4-1314-0410-8aa9-9f06e86f4224>2011-05-29 00:47:11 +0000
commitb7eed771d1bc9b29cbe2c3f796e496ffb83bda62 (patch)
treea00b064a27d3bf0cc85ceebea6b0242103f91f44 /jackd/clientengine.c
parent70adc7d48a8d647499fcf3189f1f3c12fa99fa86 (diff)
downloadjack1-b7eed771d1bc9b29cbe2c3f796e496ffb83bda62.tar.gz
[engine] relax the rules for zombification
we now give a client which didnt finish, a bit more time to complete its process_cb. this should prevent most cases of unjustified client zombification. however we can get streams of xruns, because we can overload the cpu now. git-svn-id: svn+ssh://jackaudio.org/trunk/jack@4428 0c269be4-1314-0410-8aa9-9f06e86f4224
Diffstat (limited to 'jackd/clientengine.c')
-rw-r--r--jackd/clientengine.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/jackd/clientengine.c b/jackd/clientengine.c
index d7402c4..873df48 100644
--- a/jackd/clientengine.c
+++ b/jackd/clientengine.c
@@ -33,6 +33,7 @@
#include <jack/engine.h>
#include <jack/messagebuffer.h>
#include <jack/version.h>
+#include <jack/driver.h>
#include <sysdeps/poll.h>
#include <sysdeps/ipc.h>
@@ -269,9 +270,23 @@ jack_check_clients (jack_engine_t* engine, int with_timeout_check)
if (client->control->awake_at > 0) {
if (client->control->finished_at == 0) {
- client->control->timed_out++;
- client->error++;
- VERBOSE (engine, "client %s has timed out", client->control->name);
+ jack_time_t now = jack_get_microseconds();
+
+ if ((now - client->control->awake_at) < engine->driver->period_usecs) {
+ /* we give the client a bit of time, to finish the cycle
+ * we assume here, that we dont get signals delivered to this thread.
+ */
+ struct timespec wait_time;
+ wait_time.tv_sec = 0;
+ wait_time.tv_nsec = engine->driver->period_usecs - (now - client->control->awake_at);
+ nanosleep (&wait_time, NULL);
+ }
+
+ if (client->control->finished_at == 0) {
+ client->control->timed_out++;
+ client->error++;
+ VERBOSE (engine, "client %s has timed out", client->control->name);
+ }
}
}
}