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
add gatherv test
[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 80731055829c72d4fcc18eb8cbd610c9e57c37dd..52a00802569d253acedbd4c7ab78909e1b35ff88 100644
(file)
--- a/
examples/sthread/pthread-producer-consumer.c
+++ b/
examples/sthread/pthread-producer-consumer.c
@@
-57,7
+57,7
@@
static void* consumer(void* id)
int main(int argc, char** argv)
{
int main(int argc, char** argv)
{
-
char
opt;
+
int
opt;
while ((opt = getopt(argc, argv, "c:C:p:P:q")) != -1) {
switch (opt) {
case 'q':
while ((opt = getopt(argc, argv, "c:C:p:P:q")) != -1) {
switch (opt) {
case 'q':
@@
-75,7
+75,7
@@
int main(int argc, char** argv)
case 'P':
ProducerCount = atoi(optarg);
break;
case 'P':
ProducerCount = atoi(optarg);
break;
- case '?':
+ default: /* '?' */
printf("unknown option: %c\n", optopt);
break;
}
printf("unknown option: %c\n", optopt);
break;
}
@@
-87,7
+87,7
@@
int main(int argc, char** argv)
sem_init(&empty, 0, BufferSize);
sem_init(&full, 0, 0);
sem_init(&empty, 0, BufferSize);
sem_init(&full, 0, 0);
- int* ids = malloc(sizeof(int) * (
(ProducerCount + ConsumerCount)
));
+ int* ids = malloc(sizeof(int) * (
ProducerCount + ConsumerCount
));
for (int i = 0; i < ProducerCount + ConsumerCount; i++)
ids[i] = i + 1; // The identity of each thread (for debug messages)
for (int i = 0; i < ProducerCount + ConsumerCount; i++)
ids[i] = i + 1; // The identity of each thread (for debug messages)