starpu_top_message_queue.h 1.7 KB

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