Kernel improvements (#485)
* **New Features** * Added public accessors for querying module/device start and ready state. * **Refactor** * Internal state moved to opaque internal objects; module/device/driver initializers now explicitly initialize internal pointers. * Lifecycle handling updated to construct/destruct internal state and use accessors. * **Tests** * Tests updated to use public accessors and explicit construct/destruct lifecycle calls. * **Chores** * Test build/include paths and small metadata updated.
This commit is contained in:
committed by
GitHub
parent
1757af859c
commit
79e43b093a
@@ -0,0 +1,28 @@
|
||||
#include "doctest.h"
|
||||
#include <Tactility/DispatcherThread.h>
|
||||
|
||||
using namespace tt;
|
||||
|
||||
TEST_CASE("DispatcherThread state test") {
|
||||
DispatcherThread thread("test");
|
||||
CHECK_EQ(thread.isStarted(), false);
|
||||
|
||||
thread.start();
|
||||
CHECK_EQ(thread.isStarted(), true);
|
||||
|
||||
thread.stop();
|
||||
CHECK_EQ(thread.isStarted(), false);
|
||||
}
|
||||
|
||||
TEST_CASE("DispatcherThread should consume jobs") {
|
||||
DispatcherThread thread("test");
|
||||
thread.start();
|
||||
int counter = 0;
|
||||
|
||||
thread.dispatch([&counter]() { counter++; });
|
||||
|
||||
tt::kernel::delayTicks(10);
|
||||
|
||||
CHECK_EQ(counter, 1);
|
||||
thread.stop();
|
||||
}
|
||||
Reference in New Issue
Block a user