gc.h 1.5 KB

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