/*
* Copyright 2021 Jeisson Hidalgo-Cespedes - Universidad de Costa Rica
*/
#ifndef ARGUMENTS_H
#define ARGUMENTS_H
#include <pthread.h>
#include <semaphore.h>
#include <stdbool.h>
#include <unistd.h>
#include "queue.h"
typedef struct shared_data {
size_t product_count;
size_t next_product_index;
pthread_mutex_t next_product_mutex;
queue_t queue;
size_t producer_count;
size_t consumer_count;
useconds_t min_producer_delay;
useconds_t max_producer_delay;
useconds_t min_consumer_delay;
useconds_t max_consumer_delay;
sem_t can_consume;
pthread_mutex_t stdout_mutex;
} shared_thread_data_t;
typedef struct private_thread_data {
size_t thread_number; // rank
shared_thread_data_t* shared_data;
} private_thread_data_t;
int analyze_arguments(int argc, char* argv[]
, shared_thread_data_t* shared_data);
#endif // ARGUMENTS_H