23 lines
500 B
C
23 lines
500 B
C
#ifndef SHARED_H
|
|
#define SHARED_H
|
|
#include <semaphore.h>
|
|
|
|
int StringToNumber(char* argv);
|
|
|
|
typedef struct SharedStruct
|
|
{
|
|
int buffer[10];
|
|
int count[10];
|
|
int producerCount;
|
|
int consumerCount;
|
|
sem_t mutex;
|
|
sem_t empty;
|
|
sem_t full;
|
|
} SharedStruct;
|
|
|
|
int IsProductionFinished(SharedStruct* sharedMem);
|
|
void SharedStructInit(SharedStruct* sharedMem, int producers, int consumers);
|
|
void PrintBuffer(SharedStruct* sharedMem);
|
|
void PrintNumberCount(SharedStruct* sharedMem);
|
|
|
|
#endif |