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;
};
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);
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);
}
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);
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);
/* 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);