1
0

heap_leak_mutex.c 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #include <pthread.h>
  2. #include <stdio.h>
  3. #include "../private.h"
  4. #include "../context.h"
  5. static pthread_mutex_t leak_mutex = PTHREAD_MUTEX_INITIALIZER;
  6. static lub_heap_leak_t instance;
  7. /*--------------------------------------------------------- */
  8. void lub_heap_leak_mutex_lock(void)
  9. {
  10. int status = pthread_mutex_lock(&leak_mutex);
  11. if (0 != status) {
  12. perror("pthread_mutex_lock() failed");
  13. }
  14. }
  15. /*--------------------------------------------------------- */
  16. void lub_heap_leak_mutex_unlock(void)
  17. {
  18. int status = pthread_mutex_unlock(&leak_mutex);
  19. if (0 != status) {
  20. perror("pthread_mutex_unlock() failed");
  21. }
  22. }
  23. /*--------------------------------------------------------- */
  24. lub_heap_leak_t *lub_heap_leak_instance(void)
  25. {
  26. lub_heap_leak_mutex_lock();
  27. return &instance;
  28. }
  29. /*--------------------------------------------------------- */
  30. void lub_heap_leak_release(lub_heap_leak_t * instance)
  31. {
  32. lub_heap_leak_mutex_unlock();
  33. }
  34. /*--------------------------------------------------------- */
  35. bool_t lub_heap_leak_query_node_tree(void)
  36. {
  37. return BOOL_TRUE;
  38. }
  39. /*--------------------------------------------------------- */
  40. bool_t lub_heap_leak_query_clear_node_tree(void)
  41. {
  42. return BOOL_TRUE;
  43. }
  44. /*--------------------------------------------------------- */