gc.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2012,2013,2017 CNRS
  4. * Copyright (C) 2010,2011,2013 Université de Bordeaux
  5. * Copyright (C) 2011 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 SOCL_GC_H
  19. #define SOCL_GC_H
  20. #include "socl.h"
  21. void gc_start(void);
  22. void gc_stop(void);
  23. void gc_entity_init(void *arg, void (*release_callback)(void*), char*name);
  24. void * gc_entity_alloc(unsigned int size, void (*release_callback)(void*), char * name);
  25. void gc_entity_retain_ex(void *arg, const char *);
  26. #define gc_entity_retain(arg) gc_entity_retain_ex(arg, __starpu_func__)
  27. /** Decrement reference counter and release entity if applicable */
  28. int gc_entity_release_ex(entity e, const char*);
  29. int gc_active_entity_count(void);
  30. void gc_print_remaining_entities(void);
  31. #define gc_entity_release(a) gc_entity_release_ex(&(a)->_entity, __starpu_func__)
  32. #define gc_entity_store(dest,e) \
  33. do {\
  34. void * _e = e;\
  35. gc_entity_retain(_e); \
  36. *dest = _e;\
  37. } while(0);
  38. #define gc_entity_unstore(dest) \
  39. do {\
  40. gc_entity_release(*dest); \
  41. *dest = NULL;\
  42. } while(0);
  43. #endif