Activate shared memory and semaphores
This commit is contained in:
parent
160d66c9c4
commit
80afbc9473
@ -170,9 +170,8 @@ void printGraph()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void putItem(int itemValue)
|
void putSolution(sem_t sUsedSpace, sem_t sFreeSpace, int *solution)
|
||||||
{
|
{
|
||||||
shared->validItems++;
|
|
||||||
shared->data[shared->tail] = itemValue;
|
shared->data[shared->tail] = itemValue;
|
||||||
shared->tail = (shared->tail + 1) % MAX_ITEMS;
|
shared->tail = (shared->tail + 1) % MAX_ITEMS;
|
||||||
}
|
}
|
||||||
@ -260,7 +259,6 @@ int main(int argc, char *argv[])
|
|||||||
sigaction(SIGINT, &sa, NULL);
|
sigaction(SIGINT, &sa, NULL);
|
||||||
sigaction(SIGTERM, &sa, NULL);
|
sigaction(SIGTERM, &sa, NULL);
|
||||||
|
|
||||||
/*
|
|
||||||
int shmfd = shm_open(SHM_NAME, O_RDWR | O_CREAT, PERMISSION);
|
int shmfd = shm_open(SHM_NAME, O_RDWR | O_CREAT, PERMISSION);
|
||||||
if (shmfd == -1) {
|
if (shmfd == -1) {
|
||||||
perror(pname);
|
perror(pname);
|
||||||
@ -280,7 +278,6 @@ int main(int argc, char *argv[])
|
|||||||
perror(pname);
|
perror(pname);
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
parse(argc, argv);
|
parse(argc, argv);
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user