projects
/
experiments
/
double-buffering.git
/ commitdiff
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
34c39b4
)
Fix a typo: s/font_buffer/front_buffer/g
author
Antonio Ospite <ospite@studenti.unina.it>
Fri, 5 Apr 2013 14:45:03 +0000
(16:45 +0200)
committer
Antonio Ospite <ospite@studenti.unina.it>
Fri, 5 Apr 2013 14:45:03 +0000
(16:45 +0200)
double-buffering.c
patch
|
blob
|
history
diff --git
a/double-buffering.c
b/double-buffering.c
index
244d576
..
b4d3f01
100644
(file)
--- 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;
struct double_buffer_context {
struct buffer buffer[2];
int back_buffer_index;
- int font_buffer_is_consumable;
+ int f
r
ont_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->f
r
ont_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->f
r
ont_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->f
r
ont_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->f
r
ont_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->f
r
ont_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->f
r
ont_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);