From 09bdf20aa0a6e29265e5e7b81b941a2b894be3db Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Mon, 13 Jul 2020 13:27:23 +0200 Subject: render: keep lock while pushing dirty rows to worker queue Instead of locking the queue for each dirty row we append, and signaling a condition variable, just keep the lock while going through the visible rows. Release the lock once done. Since we take the lock *before* posting the 'start' semaphore, all workers will be waiting for the lock to be released. Then, one at a time they'll get the lock and pick a row to render. The queue will never get empty - when all rows have been rendered, each worker will pick a 'frame done' "job" from the queue, and break the rendering loop. --- terminal.h | 1 - 1 file changed, 1 deletion(-) (limited to 'terminal.h') diff --git a/terminal.h b/terminal.h index 1c040b00..1193a680 100644 --- a/terminal.h +++ b/terminal.h @@ -369,7 +369,6 @@ struct terminal { size_t count; sem_t start; sem_t done; - cnd_t cond; mtx_t lock; tll(int) queue; thrd_t *threads; -- cgit v1.3