Merge develop into main (#150)
- Update `Configuration` to use C++ vector instead of C arrays - Rename `Desktop` app to `Launcher` - Fix for hard-coded app start of `Launcher` and `CrashDiagnostics` apps. - Ensure `Launcher` icons are clickable, even if they're not loading. - Don't show error scenario for SD card in statusbar when SD card status is unknown (this happens during Mutex timeout due to LVGL rendering delays) - Cleanup deprecated `Mutex` methods. - `hal::getConfiguration()` now returns a pointer instead of a reference, just like `tt:getConfiguration()`
This commit is contained in:
committed by
GitHub
parent
415096c3b2
commit
4f360741a1
@@ -4,33 +4,31 @@
|
||||
|
||||
using namespace tt;
|
||||
|
||||
static int thread_with_mutex_parameter(void* parameter) {
|
||||
static int32_t thread_with_mutex_parameter(void* parameter) {
|
||||
auto* mutex = (Mutex*)parameter;
|
||||
tt_mutex_acquire(mutex, TtWaitForever);
|
||||
mutex->lock(portMAX_DELAY);
|
||||
return 0;
|
||||
}
|
||||
|
||||
TEST_CASE("a mutex can block a thread") {
|
||||
auto* mutex = tt_mutex_alloc(Mutex::TypeNormal);
|
||||
tt_mutex_acquire(mutex, TtWaitForever);
|
||||
auto mutex = Mutex(Mutex::TypeNormal);
|
||||
mutex.lock(portMAX_DELAY);
|
||||
|
||||
Thread* thread = new Thread(
|
||||
Thread thread = Thread(
|
||||
"thread",
|
||||
1024,
|
||||
&thread_with_mutex_parameter,
|
||||
mutex
|
||||
&mutex
|
||||
);
|
||||
thread->start();
|
||||
thread.start();
|
||||
|
||||
kernel::delayMillis(5);
|
||||
CHECK_EQ(thread->getState(), Thread::StateRunning);
|
||||
CHECK_EQ(thread.getState(), Thread::StateRunning);
|
||||
|
||||
tt_mutex_release(mutex);
|
||||
mutex.unlock();
|
||||
|
||||
kernel::delayMillis(5);
|
||||
CHECK_EQ(thread->getState(), Thread::StateStopped);
|
||||
CHECK_EQ(thread.getState(), Thread::StateStopped);
|
||||
|
||||
thread->join();
|
||||
delete thread;
|
||||
tt_mutex_free(mutex);
|
||||
thread.join();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user