record.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #pragma once
  2. #include <stdbool.h>
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. /**
  7. * Initialize record storage
  8. * For internal use only.
  9. */
  10. void furi_record_init();
  11. /**
  12. * Create record
  13. * @param name - record name
  14. * @param data - data pointer
  15. * @note Thread safe. Create and destroy must be executed from the same thread.
  16. */
  17. void furi_record_create(const char* name, void* data);
  18. /**
  19. * Destroy record
  20. * @param name - record name
  21. * @return true if successful, false if still have holders or thread is not owner.
  22. * @note Thread safe. Create and destroy must be executed from the same thread.
  23. */
  24. bool furi_record_destroy(const char* name);
  25. /**
  26. * Open record
  27. * @param name - record name
  28. * @return pointer to the record
  29. * @note Thread safe. Open and close must be executed from the same thread.
  30. * Suspends caller thread till record appear
  31. */
  32. void* furi_record_open(const char* name);
  33. /**
  34. * Close record
  35. * @param name - record name
  36. * @note Thread safe. Open and close must be executed from the same thread.
  37. */
  38. void furi_record_close(const char* name);
  39. #ifdef __cplusplus
  40. }
  41. #endif