Fix a typo: s/font_buffer/front_buffer/g
authorAntonio Ospite <ospite@studenti.unina.it>
Fri, 5 Apr 2013 14:45:03 +0000 (16:45 +0200)
committerAntonio Ospite <ospite@studenti.unina.it>
Fri, 5 Apr 2013 14:45:03 +0000 (16:45 +0200)
double-buffering.c

index 244d576..b4d3f01 100644 (file)
@@ -54,7 +54,7 @@ struct buffer {
 struct double_buffer_context {
        struct buffer buffer[2];
        int back_buffer_index;
 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;
 };
        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(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);
                        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);
                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);
        }
                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->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);
 
        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);
                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 */
                        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);
                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);
 
        /* 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);
                pthread_cond_wait(&ctx->front_buffer_cond, &ctx->mutex);
        }
        pthread_mutex_unlock(&ctx->mutex);