This examples demonstrates how to use notifcation objects as a thread synchronization mechanism.
extern "C" {
void __cxa_pure_virtual(void) {}
void DebugPrint(const char* szString_);
}
namespace
{
void App1Main(void* unused_);
void App2Main(void* unused_);
void IdleMain(void* )
{
while (1) {}
}
void App1Main(void* unused_)
{
while (1) {
auto bNotified = false;
clNotify.
Wait(&bNotified);
}
}
void App2Main(void* unused_)
{
while (1) {
}
}
}
int main(void)
{
clIdleThread.Init(awIdleStack, sizeof(awIdleStack), 0, IdleMain, 0);
clIdleThread.Start();
clApp1Thread.Init(awApp1Stack, sizeof(awApp1Stack), 1, App1Main, 0);
clApp1Thread.Start();
clApp2Thread.Init(awApp2Stack, sizeof(awApp2Stack), 1, App2Main, 0);
clApp2Thread.Start();
clNotify.Init();
return 0;
}