gc.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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*));
  22. void * gc_entity_alloc(unsigned int size, void (*release_callback)(void*));
  23. void gc_entity_retain(void *arg);
  24. /** Decrement reference counter and release entity if applicable */
  25. int gc_entity_release_ex(entity e);
  26. int gc_active_entity_count(void);
  27. #define gc_entity_release(a) gc_entity_release_ex(&(a)->_entity)
  28. #define gc_entity_store(dest,e) \
  29. do {\
  30. gc_entity_retain(e); \
  31. *dest = e;\
  32. } while(0);
  33. #define gc_entity_unstore(dest) \
  34. do {\
  35. gc_entity_release(*dest); \
  36. *dest = NULL;\
  37. } while(0);
  38. #endif