A new template for Lab 5 (Consumer Producer Assignment) based on the old one.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
447 B

  1. #include "queue.h"
  2. /******* Unix (Linux/MacOS) *******/
  3. #ifdef UNIX
  4. #include <pthread.h>
  5. #include <unistd.h>
  6. #define thread_t pthread_t
  7. #define sleep_milliseconds(ms) usleep(ms * 1000)
  8. #endif
  9. /******* Windows *******/
  10. #ifdef WINDOWS
  11. #include <windows.h>
  12. #define thread_t HANDLE
  13. #define sleep_milliseconds(ms) Sleep(ms)
  14. #endif
  15. void create_thread(thread_t *t, void (*f)(queue *), queue *q);
  16. void wait_for_threads(thread_t *ts, int c);