File locking and DevelopmentService improvements (#358)
- Moved `file::getlock(path)` from `Tactility` to `TactilityCore` - Changed all existing `file::*` functions to implement locking by default - Removed all manual locking where `file::*` functions were used - When `DevelopmentService` receives a file, it doesn't try to allocate it all in memory. This fixes going out-of-memory on devices without PSRAM. - Fix for TactilityC include
This commit is contained in:
committed by
GitHub
parent
a05a6afaaf
commit
3802679de4
@@ -5,20 +5,8 @@
|
||||
|
||||
namespace tt::file {
|
||||
|
||||
class NoLock : public Lock {
|
||||
bool lock(TickType_t timeout) const override { return true; }
|
||||
bool unlock() const override { return true; }
|
||||
};
|
||||
|
||||
static std::shared_ptr<Lock> noLock = std::make_shared<NoLock>();
|
||||
|
||||
std::shared_ptr<Lock> getLock(const std::string& path) {
|
||||
auto sdcard_lock = hal::sdcard::findSdCardLock(path);
|
||||
if (sdcard_lock != nullptr) {
|
||||
return sdcard_lock;
|
||||
} else {
|
||||
return noLock;
|
||||
}
|
||||
std::shared_ptr<Lock> _Nullable findLock(const std::string& path) {
|
||||
return hal::sdcard::findSdCardLock(path);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user