From: Antonio Ospite Date: Fri, 5 Apr 2013 14:45:03 +0000 (+0200) Subject: Fix a typo: s/font_buffer/front_buffer/g X-Git-Url: https://git.ao2.it/experiments/double-buffering.git/commitdiff_plain/8aaf9a727aa73ee9bbb28f942f4a4eb672a7ab78?ds=inline;hp=34c39b440bec3f548cb0d1ecb02cebe46d60db75 Fix a typo: s/font_buffer/front_buffer/g --- diff --git a/double-buffering.c b/double-buffering.c index 244d576..b4d3f01 100644 --- a/double-buffering.c +++ b/double-buffering.c @@ -54,7 +54,7 @@ struct buffer { struct double_buffer_context { struct buffer buffer[2]; int back_buffer_index; - int font_buffer_is_consumable; + int front_buffer_is_consumable; pthread_cond_t front_buffer_cond; pthread_mutex_t mutex; }; @@ -84,7 +84,7 @@ static void *consumer_cb(void *arg) while(1) { pthread_mutex_lock(&ctx->mutex); - while (!ctx->font_buffer_is_consumable) { + while (!ctx->front_buffer_is_consumable) { pthread_cond_wait(&ctx->front_buffer_cond, &ctx->mutex); } pthread_mutex_unlock(&ctx->mutex); @@ -98,7 +98,7 @@ static void *consumer_cb(void *arg) do_log(message); pthread_mutex_lock(&ctx->mutex); - ctx->font_buffer_is_consumable = 0; + ctx->front_buffer_is_consumable = 0; pthread_cond_signal(&ctx->front_buffer_cond); pthread_mutex_unlock(&ctx->mutex); } @@ -132,7 +132,7 @@ int main(void) ctx->buffer[1].size = BUFFER_SIZE; ctx->back_buffer_index = 0; - ctx->font_buffer_is_consumable = 0; + ctx->front_buffer_is_consumable = 0; pthread_mutex_init(&ctx->mutex, NULL); pthread_cond_init(&ctx->front_buffer_cond, NULL); @@ -157,14 +157,14 @@ int main(void) do_log(message); pthread_mutex_lock(&ctx->mutex); - while (ctx->font_buffer_is_consumable) { + while (ctx->front_buffer_is_consumable) { pthread_cond_wait(&ctx->front_buffer_cond, &ctx->mutex); } SWAP_BUFFERS(ctx); /* signal that the front buffer is ready to be consumed */ - ctx->font_buffer_is_consumable = 1; + ctx->front_buffer_is_consumable = 1; pthread_cond_signal(&ctx->front_buffer_cond); pthread_mutex_unlock(&ctx->mutex); @@ -172,7 +172,7 @@ int main(void) /* wait for the last consumer run before terminating the thread */ pthread_mutex_lock(&ctx->mutex); - while (ctx->font_buffer_is_consumable) { + while (ctx->front_buffer_is_consumable) { pthread_cond_wait(&ctx->front_buffer_cond, &ctx->mutex); } pthread_mutex_unlock(&ctx->mutex);