summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--turbowc.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/turbowc.c b/turbowc.c
index 0756549..65a25e1 100644
--- a/turbowc.c
+++ b/turbowc.c
@@ -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;