record.h 1.2 KB

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