Ken Van Hoeylandt 4f360741a1
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()`
2025-01-07 21:57:03 +01:00

35 lines
705 B
C++

#include "doctest.h"
#include "TactilityCore.h"
#include "Mutex.h"
using namespace tt;
static int32_t thread_with_mutex_parameter(void* parameter) {
auto* mutex = (Mutex*)parameter;
mutex->lock(portMAX_DELAY);
return 0;
}
TEST_CASE("a mutex can block a thread") {
auto mutex = Mutex(Mutex::TypeNormal);
mutex.lock(portMAX_DELAY);
Thread thread = Thread(
"thread",
1024,
&thread_with_mutex_parameter,
&mutex
);
thread.start();
kernel::delayMillis(5);
CHECK_EQ(thread.getState(), Thread::StateRunning);
mutex.unlock();
kernel::delayMillis(5);
CHECK_EQ(thread.getState(), Thread::StateStopped);
thread.join();
}