diff --git a/generator.c b/generator.c index 43d5259..5673910 100644 --- a/generator.c +++ b/generator.c @@ -177,14 +177,14 @@ void putSolution(sem_t sUsedSpace, sem_t sFreeSpace, sem_t sWriteEnd, int *solut if (solution[0] == -1) { sem_wait(&sFreeSpace); shared->data[shared->tail] = -1; - shared->tail = (shared->tail + 1) % MAX_ITEMS; + shared->tail = (shared->tail + 1) % CIRC_BUF_SIZE; sem_post(&sUsedSpace); } else { int i = 0; while (solution[i] != -1) { sem_wait(&sFreeSpace); shared->data[shared->tail] = solution[i]; - shared->tail = (shared->tail + 1) % MAX_ITEMS; + shared->tail = (shared->tail + 1) % CIRC_BUF_SIZE; sem_post(&sUsedSpace); i++; }