File locking deprecation replacements (#593)
This commit is contained in:
committed by
GitHub
parent
d1f06cb774
commit
58a529cc44
@@ -1,14 +1,14 @@
|
||||
#include <Tactility/lvgl/LabelUtils.h>
|
||||
#include <Tactility/file/File.h>
|
||||
#include <Tactility/file/FileLock.h>
|
||||
|
||||
namespace tt::lvgl {
|
||||
|
||||
bool label_set_text_file(lv_obj_t* label, const char* filepath) {
|
||||
std::unique_ptr<uint8_t[]> text;
|
||||
file::getLock(filepath)->withLock([&text, filepath] {
|
||||
{
|
||||
file::FileMutexGuard guard(filepath);
|
||||
text = file::readString(filepath);
|
||||
});
|
||||
}
|
||||
|
||||
if (text != nullptr) {
|
||||
lv_label_set_text(label, reinterpret_cast<const char*>(text.get()));
|
||||
|
||||
Reference in New Issue
Block a user