cl_releaseevent.c.inc 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2010,2011 University of Bordeaux
  4. *
  5. * StarPU is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU Lesser General Public License as published by
  7. * the Free Software Foundation; either version 2.1 of the License, or (at
  8. * your option) any later version.
  9. *
  10. * StarPU is distributed in the hope that it will be useful, but
  11. * WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  13. *
  14. * See the GNU Lesser General Public License in COPYING.LGPL for more details.
  15. */
  16. static void release_callback_event(void * e) {
  17. cl_event event = (cl_event)e;
  18. cl_command_queue cq = event->cq;
  19. /* Remove from command queue */
  20. if (cq != NULL) {
  21. /* Lock command queue */
  22. pthread_spin_lock(&cq->spin);
  23. /* Remove barrier if applicable */
  24. if (cq->barrier == event)
  25. cq->barrier = NULL;
  26. /* Remove from the list of out-of-order events */
  27. if (event->prev != NULL)
  28. event->prev->next = event->next;
  29. if (event->next != NULL)
  30. event->next->prev = event->prev;
  31. if (cq->events == event)
  32. cq->events = event->next;
  33. /* Unlock command queue */
  34. pthread_spin_unlock(&cq->spin);
  35. gc_entity_unstore(&cq);
  36. }
  37. /* Destruct object */
  38. //FIXME: we cannot release tag because it makes StarPU crash
  39. //starpu_tag_remove(event->id);
  40. }
  41. CL_API_ENTRY cl_int CL_API_CALL
  42. soclReleaseEvent(cl_event event) CL_API_SUFFIX__VERSION_1_0
  43. {
  44. if (event == NULL)
  45. return CL_INVALID_EVENT;
  46. gc_entity_release(event);
  47. return CL_SUCCESS;
  48. }