starpu_top_message_queue.h 1.6 KB

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