record.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. /** Check if record exists
  14. *
  15. * @param name record name
  16. * @note Thread safe. Create and destroy must be executed from the same
  17. * thread.
  18. */
  19. bool furi_record_exists(const char* name);
  20. /** Create record
  21. *
  22. * @param name record name
  23. * @param data data pointer
  24. * @note Thread safe. Create and destroy must be executed from the same
  25. * thread.
  26. */
  27. void furi_record_create(const char* name, void* data);
  28. /** Destroy record
  29. *
  30. * @param name record name
  31. *
  32. * @return true if successful, false if still have holders or thread is not
  33. * owner.
  34. * @note Thread safe. Create and destroy must be executed from the same
  35. * thread.
  36. */
  37. bool furi_record_destroy(const char* name);
  38. /** Open record
  39. *
  40. * @param name record name
  41. *
  42. * @return pointer to the record
  43. * @note Thread safe. Open and close must be executed from the same
  44. * thread. Suspends caller thread till record is available
  45. */
  46. void* furi_record_open(const char* name);
  47. /** Close record
  48. *
  49. * @param name record name
  50. * @note Thread safe. Open and close must be executed from the same
  51. * thread.
  52. */
  53. void furi_record_close(const char* name);
  54. #ifdef __cplusplus
  55. }
  56. #endif