A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix a dead store reported by infer
[simgrid.git]
/
examples
/
sthread
/
pthread-producer-consumer.c
diff --git
a/examples/sthread/pthread-producer-consumer.c
b/examples/sthread/pthread-producer-consumer.c
index
52a0080
..
fe3fe5d
100644
(file)
--- a/
examples/sthread/pthread-producer-consumer.c
+++ b/
examples/sthread/pthread-producer-consumer.c
@@
-45,9
+45,10
@@
static void* consumer(void* id)
for (int i = 0; i < AmountConsumed; i++) {
sem_wait(&full);
pthread_mutex_lock(&mutex);
for (int i = 0; i < AmountConsumed; i++) {
sem_wait(&full);
pthread_mutex_lock(&mutex);
- i
nt item = buffer[out];
- if (do_output)
+ i
f (do_output) {
+ int item = buffer[out];
fprintf(stderr, "Consumer %d: Remove Item %d from %d\n", *((int*)id), item, out);
fprintf(stderr, "Consumer %d: Remove Item %d from %d\n", *((int*)id), item, out);
+ }
out = (out + 1) % BufferSize;
pthread_mutex_unlock(&mutex);
sem_post(&empty);
out = (out + 1) % BufferSize;
pthread_mutex_unlock(&mutex);
sem_post(&empty);