Download c source code

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
// Copyright 2021 Jeisson Hidalgo-Cespedes <jeisson.hidalgo@ucr.ac.cr> CC-BY-4
// Simulates a producer and a consumer that share a unbounded buffer

#include <stdlib.h>
#include <stdio.h>

#include "simulation.h"

int main(int argc, char* argv[]) {
  int error = EXIT_SUCCESS;
  simulation_t* simulation = simulation_create();
  if (simulation) {
    error = simulation_run(simulation, argc, argv);
    simulation_destroy(simulation);
  } else {
    fprintf(stderr, "error: could not allocate simulation\n");
    error = EXIT_FAILURE;
  }
  return error;
}