errorcheck.h 1.9 KB

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