#include "list.h" struct player_sync_helper { /* add any fields you need here. */ }; /* Initialize any state needed to synchronize the game threads. */ void init_game_synchronization(void); /* Ensure that only the calling player has exclusive access to the * "game table" - the data structures describing what cards are on the * pile in the center of the table. */ void ensure_exclusive_access_to_the_game_table(struct player_sync_helper *); /* * Release said exclusive access, allowing others access. */ void relinquish_exclusive_access_to_the_game_table(struct player_sync_helper *); /* * This function should block the caller until some other thread * calls `tell_everyone_to_recheck_the_game_state` * * Precondition: caller has exclusive access to game state. * * While blocked, however, the exclusive game state access must be * relinquished. Once unblocked, it must be reacquired. * * Postcondition: caller has exclusive access to game state. */ void wait_for_game_state_change(struct player_sync_helper *); /* * Unblock every player who is currently waiting for a game * state change. */ void tell_everyone_to_recheck_the_game_state(void);