CMSDK 2.0.1
Cross-platform C++ base library and SDK for the Psyclone AIOS platform
Loading...
Searching...
No Matches
ThreadManager.cpp File Reference

Implementation of the ThreadManager singleton, its monitoring thread and its self-contained unit test. More...

#include "ThreadManager.h"
#include "PsyTime.h"
#include "Utils.h"
#include "UnitTestFramework.h"
Include dependency graph for ThreadManager.cpp:

Go to the source code of this file.

Namespaces

namespace  cmlabs

Functions

static THREAD_RET THREAD_FUNCTION_CALL cmlabs::ThreadMonitoring (void *arg)
 Entry function of the monitoring thread; delegates to ThreadManager::threadMonitoring().
void cmlabs::Register_ThreadManager_Tests ()

Detailed Description

Implementation of the ThreadManager singleton, its monitoring thread and its self-contained unit test.

See ThreadManager.h for the design overview (contiguous storage block, statistics collection policies, platform differences). Implementation highlights:

  • Static entry points lazily create the singleton before delegating to the instance-side worker of the same (lowercase) name.
  • The occupancy bitfield is initialised to all-ones meaning "free"; slot allocation uses utils::GetFirstFreeBitLoc / utils::SetBit.
  • The monitoring thread (ThreadMonitoring, slot 0) wakes every 100 ms and does a full statistics pass roughly once per second.

Definition in file ThreadManager.cpp.