errorcheck.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2009, 2010 Université de Bordeaux 1
  4. * Copyright (C) 2010 Centre National de la Recherche Scientifique
  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. #ifndef __ERRORCHECK_H__
  18. #define __ERRORCHECK_H__
  19. #include <starpu.h>
  20. /* This type describes in which state a worker may be. */
  21. typedef enum {
  22. /* invalid status (for instance if we request the status of some thread
  23. * that is not controlled by StarPU */
  24. STATUS_INVALID,
  25. /* everything that does not fit the other status */
  26. STATUS_UNKNOWN,
  27. /* during the initialization */
  28. STATUS_INITIALIZING,
  29. /* during the execution of a codelet */
  30. STATUS_EXECUTING,
  31. /* during the execution of the callback */
  32. STATUS_CALLBACK,
  33. /* while sleeping because there is nothing to do */
  34. STATUS_SLEEPING
  35. } starpu_worker_status;
  36. /* Specify what the local worker is currently doing (eg. executing a callback).
  37. * This permits to detect if this is legal to do a blocking call for instance.
  38. * */
  39. void _starpu_set_local_worker_status(starpu_worker_status st);
  40. /* Indicate what type of operation the worker is currently doing. */
  41. starpu_worker_status _starpu_get_local_worker_status(void);
  42. /* It is forbidden to do blocking calls during some operations such as callback
  43. * or during the execution of a task. This function indicates whether it is
  44. * legal to call a blocking operation in the current context. */
  45. unsigned _starpu_worker_may_perform_blocking_calls(void);
  46. #endif // __ERRORCHECK_H__