mirror of
https://github.com/DarkFlippers/unleashed-firmware.git
synced 2025-12-12 20:49:49 +04:00
* Ensure that `furi_record_create` is passed a non-NULL data pointer It's currently possible to use `furi_record_create` to create and initialize a `FuriRecordData` pointing to NULL. This means its potentially possible for `furi_record_open` to return a NULL pointer which besides not being particularly useful means the Rust wrapper for `Record` can't assume that the returned record is always a non-NULL value. If by chance this is the intended behaviour, then we can just have the Rust wrapper do a `furi_check` itself, but it seems like it would be better to eliminate this potential corner-case at the source. * Furi: update furi_record_create documentation Co-authored-by: あく <alleteam@gmail.com>
68 lines
1.5 KiB
C
68 lines
1.5 KiB
C
/**
|
|
* @file record.h
|
|
* Furi: record API
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <stdbool.h>
|
|
#include "core_defines.h"
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/** Initialize record storage For internal use only.
|
|
*/
|
|
void furi_record_init(void);
|
|
|
|
/** Check if record exists
|
|
*
|
|
* @param name record name
|
|
* @note Thread safe. Create and destroy must be executed from the same
|
|
* thread.
|
|
*/
|
|
bool furi_record_exists(const char* name);
|
|
|
|
/** Create record
|
|
*
|
|
* @param name record name
|
|
* @param data data pointer (not NULL)
|
|
* @note Thread safe. Create and destroy must be executed from the same
|
|
* thread.
|
|
*/
|
|
void furi_record_create(const char* name, void* data);
|
|
|
|
/** Destroy record
|
|
*
|
|
* @param name record name
|
|
*
|
|
* @return true if successful, false if still have holders or thread is not
|
|
* owner.
|
|
* @note Thread safe. Create and destroy must be executed from the same
|
|
* thread.
|
|
*/
|
|
bool furi_record_destroy(const char* name);
|
|
|
|
/** Open record
|
|
*
|
|
* @param name record name
|
|
*
|
|
* @return pointer to the record
|
|
* @note Thread safe. Open and close must be executed from the same
|
|
* thread. Suspends caller thread till record is available
|
|
*/
|
|
FURI_RETURNS_NONNULL void* furi_record_open(const char* name);
|
|
|
|
/** Close record
|
|
*
|
|
* @param name record name
|
|
* @note Thread safe. Open and close must be executed from the same
|
|
* thread.
|
|
*/
|
|
void furi_record_close(const char* name);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|