errorcheck.h 2.2 KB

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