diff options
author | Paweł Redman <pawel.redman@gmail.com> | 2018-05-24 23:56:50 +0200 |
---|---|---|
committer | Paweł Redman <pawel.redman@gmail.com> | 2018-05-24 23:56:54 +0200 |
commit | 9dffee6932f2ca8dcab810a8cdbc16486b9aaa57 (patch) | |
tree | 1ce2d0e2445f7d3fce5bb2abada90f43f1c802f1 | |
parent | 4802048f85106d518e533967517edf642ec0cd70 (diff) |
-rw-r--r-- | turbowc.c | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -83,6 +83,8 @@ struct { .total_mutex = PTHREAD_MUTEX_INITIALIZER }; +#define CHUNK_SIZE (4194304) + static void *thread_f(void *arg) { void *data; @@ -91,13 +93,13 @@ static void *thread_f(void *arg) while (1) { pthread_mutex_lock(&data_pool.mutex); - size = data_pool.left & (~15); + size = data_pool.left - data_pool.left % CHUNK_SIZE; if (!size) { pthread_mutex_unlock(&data_pool.mutex); break; } - else if (size > 16 * 256 * 64) - size = 16 * 256 * 64; + else if (size > CHUNK_SIZE) + size = CHUNK_SIZE; data = data_pool.cursor; data_pool.cursor += size; |