destroy_task_on_error_test.c 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /*
  2. * StarPU --- Runtime system for heterogeneous multicore architectures.
  3. *
  4. * Copyright (C) 2012 inria
  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. static void
  18. good_0(void)
  19. {
  20. struct starpu_task *task;
  21. task = starpu_task_create();
  22. int ret = starpu_task_submit(task);
  23. if (ret == -ENODEV)
  24. {
  25. fprintf(stderr, "fail\n");
  26. starpu_task_destroy(task);
  27. }
  28. }
  29. static void
  30. bad_0(void)
  31. {
  32. struct starpu_task *task1, *task2;
  33. task1 = starpu_task_create();
  34. int ret = starpu_task_submit(task1);
  35. if (ret == -ENODEV)
  36. {
  37. fprintf(stderr, "Fail\n");
  38. }
  39. task2 = starpu_task_create();
  40. ret = starpu_task_submit(task2);
  41. if (ret == -ENODEV)
  42. {
  43. fprintf(stderr, "Fail\n");
  44. }
  45. }
  46. static void
  47. bad_unlikely(void)
  48. {
  49. struct starpu_task *task;
  50. task = starpu_task_create();
  51. int ret = starpu_task_submit(task);
  52. if (STARPU_UNLIKELY(ret == -ENODEV))
  53. {
  54. error();
  55. return 1;
  56. }
  57. starpu_task_destroy(task);
  58. }