/* * Functions needed for particular implementation (varies * depending on what synchronization mechanism is to be used). */ #ifndef BOUNDED_BUFFER_H #define BOUNDED_BUFFER_H #include /* initialize for synchronization */ void init_synch(const int buffer_size); /* clean up at end of program */ void end_synch(void); /* * simulate put with synchronization (wait if full) */ void simulate_put_with_synch(const int producerID); /* * simulate get with synchronization (wait if empty) */ void simulate_get_with_synch(const int consumerID); /* * atomic increment and test: * if value < limit, increments value and returns true * else returns false * (this is used only to count total puts/gets and allow simulation * to end gracefully.) */ bool atomic_increment(int *value, const int limit); #endif /* BOUNDED_BUFFER_H */