starpu_top_message_queue.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2011 William Braik, Yann Courtois, Jean-Marie Couteyen, Anthony
  4. * Roy
  5. *
  6. * StarPU is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU Lesser General Public License as published by
  8. * the Free Software Foundation; either version 2.1 of the License, or (at
  9. * your option) any later version.
  10. *
  11. * StarPU is distributed in the hope that it will be useful, but
  12. * WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  14. *
  15. * See the GNU Lesser General Public License in COPYING.LGPL for more details.
  16. */
  17. #include <sys/types.h>
  18. #include <semaphore.h>
  19. #include <common/thread.h>
  20. #ifndef __STARPU_TOP_MESSAGE_QUEUE_H__
  21. #define __STARPU_TOP_MESSAGE_QUEUE_H__
  22. struct _starpu_top_message_queue_item
  23. {
  24. char *message;
  25. struct _starpu_top_message_queue_item* next;
  26. };
  27. struct _starpu_top_message_queue
  28. {
  29. struct _starpu_top_message_queue_item* head;
  30. struct _starpu_top_message_queue_item* tail;
  31. sem_t semaphore;
  32. starpu_pthread_mutex_t mutex;
  33. };
  34. struct _starpu_top_message_queue *_starpu_top_message_add(struct _starpu_top_message_queue*,
  35. char*);
  36. char* _starpu_top_message_remove(struct _starpu_top_message_queue*);
  37. struct _starpu_top_message_queue* _starpu_top_message_queue_new();
  38. struct _starpu_top_message_queue* _starpu_top_message_queue_free(struct _starpu_top_message_queue*);
  39. #endif