diff options
author | Dimitri Staessens <[email protected]> | 2018-06-08 15:54:37 +0200 |
---|---|---|
committer | Sander Vrijders <[email protected]> | 2018-06-08 16:06:52 +0200 |
commit | 1c98f0bedc1d98d468ad0d89e57207535d068844 (patch) | |
tree | dff3b95c16c44f70744d2e9f3fac56d5578ccad4 /src/irmd | |
parent | 22be1ea9cab402a921776a59ff9667bcb5e2c299 (diff) | |
download | ouroboros-1c98f0bedc1d98d468ad0d89e57207535d068844.tar.gz ouroboros-1c98f0bedc1d98d468ad0d89e57207535d068844.zip |
irmd: Remove shm_sanitizer thread
This removes the sanitizer thread in the IRMd to avoid the IRMd eating
the CPU when the buffer is full. The processes will clean the head PDU
if there is a broken lock in the rdrbuff. Chances for a lingering tail
PDU are slim.
Signed-off-by: Dimitri Staessens <[email protected]>
Signed-off-by: Sander Vrijders <[email protected]>
Diffstat (limited to 'src/irmd')
-rw-r--r-- | src/irmd/main.c | 46 |
1 files changed, 0 insertions, 46 deletions
diff --git a/src/irmd/main.c b/src/irmd/main.c index 574223b0..aeb43f0d 100644 --- a/src/irmd/main.c +++ b/src/irmd/main.c @@ -134,7 +134,6 @@ struct { struct tpm * tpm; /* thread pool manager */ pthread_t irm_sanitize; /* clean up irmd resources */ - pthread_t shm_sanitize; /* keep track of rdrbuff use */ pthread_t acceptor; /* accept new commands */ } irmd; @@ -1683,43 +1682,6 @@ void irmd_sig_handler(int sig, } } -void * shm_sanitize(void * o) -{ - struct list_head * p = NULL; - struct timespec ts = {SHM_SAN_HOLDOFF / 1000, - (SHM_SAN_HOLDOFF % 1000) * MILLION}; - ssize_t idx; - - (void) o; - - while (irmd_get_state() == IRMD_RUNNING) { - if (shm_rdrbuff_wait_full(irmd.rdrb, &ts) == -ETIMEDOUT) - continue; - - pthread_rwlock_wrlock(&irmd.flows_lock); - - list_for_each(p, &irmd.irm_flows) { - struct irm_flow * f = - list_entry(p, struct irm_flow, next); - if (kill(f->n_pid, 0) < 0) { - while ((idx = shm_rbuff_read(f->n_rb)) >= 0) - shm_rdrbuff_remove(irmd.rdrb, idx); - continue; - } - - if (kill(f->n_1_pid, 0) < 0) { - while ((idx = shm_rbuff_read(f->n_1_rb)) >= 0) - shm_rdrbuff_remove(irmd.rdrb, idx); - continue; - } - } - - pthread_rwlock_unlock(&irmd.flows_lock); - } - - return (void *) 0; -} - void * irm_sanitize(void * o) { struct timespec now; @@ -2362,11 +2324,6 @@ int main(int argc, goto fail_irm_sanitize; } - if (pthread_create(&irmd.shm_sanitize, NULL, shm_sanitize, irmd.rdrb)) { - irmd_set_state(IRMD_NULL); - goto fail_shm_sanitize; - } - if (pthread_create(&irmd.acceptor, NULL, acceptloop, NULL)) { irmd_set_state(IRMD_NULL); goto fail_acceptor; @@ -2374,7 +2331,6 @@ int main(int argc, pthread_join(irmd.acceptor, NULL); pthread_join(irmd.irm_sanitize, NULL); - pthread_join(irmd.shm_sanitize, NULL); tpm_stop(irmd.tpm); @@ -2393,8 +2349,6 @@ int main(int argc, exit(EXIT_SUCCESS); fail_acceptor: - pthread_join(irmd.shm_sanitize, NULL); - fail_shm_sanitize: pthread_join(irmd.irm_sanitize, NULL); fail_irm_sanitize: tpm_stop(irmd.tpm); |