starpu_top_message_queue.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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 <pthread.h>
  20. #include <common/utils.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