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

The PsySpace process/node context: the runtime container in which Psyclone components (cranks) live and execute. More...

#include "MemoryManager.h"
#include "PsyTime.h"
#include "xml_parser.h"
#include "DataMessage.h"
#include "Subscriptions.h"
#include "PsyAPI.h"
#include "PsyInternal.h"
Include dependency graph for PsySpace.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  cmlabs::TimeQueueSchedule
 One recurring (or time-bounded) activation schedule managed by a TimeQueue. More...
class  cmlabs::TimeQueue
 Time-binned activation queue used by a PsySpace to drive time-triggered modules. More...
struct  cmlabs::SignalStruct
 Per-signal bookkeeping for PsySpace signal distribution. More...
class  cmlabs::PsySpace
 The runtime container (one OS process/node context) hosting Psyclone components. More...

Namespaces

namespace  cmlabs

Macros

#define LOG_SPACE   7
 Log source id used by PsySpace when writing entries to the system log.
Processing-statistics indices

Indices into PsySpace::waitCounters / PsySpace::procCounters, tracking how many pool threads are waiting on / processing each kind of work item.

#define PROCMESSAGE   0
 Ordinary trigger-message processing.
#define PROCSIGNAL   1
 Signal processing.
#define PROCREQUEST   2
 Query/request processing.

Typedefs

typedef int8(* cmlabs::CrankFunction) (PsyAPI *api)
 Signature of a component (crank) entry function.

Functions

THREAD_RET THREAD_FUNCTION_CALL cmlabs::PsySpaceRun (THREAD_ARG arg)
 Main service-thread entry: runs PsySpace::run() for the space passed in arg.
THREAD_RET THREAD_FUNCTION_CALL cmlabs::PsySpacePoolRun (THREAD_ARG arg)
 Pool worker-thread entry: runs PsySpace::threadPoolDispatch() for the space passed in arg.
THREAD_RET THREAD_FUNCTION_CALL cmlabs::PsySpaceContinuousRun (THREAD_ARG arg)
 Continuous-component thread entry: runs PsySpace::runContinuousComponent() for the space passed in arg.

Detailed Description

The PsySpace process/node context: the runtime container in which Psyclone components (cranks) live and execute.

A PsySpace represents one operating-system process participating in a Psyclone system. It owns the process-local MemoryManager (the gateway to the shared-memory fabric shared by all spaces on a node), a pool of worker threads that dispatch trigger messages to component callbacks, the local time-based scheduling queue, and the per-component PsyAPI handles.

Relationship to PsyAPI (important for newcomers): a PsySpace is the environment a component runs inside; a PsyAPI is the handle an individual component (crank) uses to interact with that environment — posting messages, waiting for triggers, emitting signals, querying catalogs, and reading parameters. One PsySpace hosts many components, each with its own PsyAPI (see PsySpace::getCrankAPI()).

Typical embedding usage:

cmlabs::PsySpace space("MyProcess");
if (!space.connect(1)) // join Psyclone system with sysid 1
return 1;
space.registerCrankCallback("MyModule.MyCrank", MyCrankFunction);
space.start(5); // start with 5 pool threads
// ... or drive a component manually:
cmlabs::PsyAPI* api = space.getCrankAPI("MyModule.MyCrank");
The API handle a component (crank) uses to talk to the Psyclone system.
Definition PsyAPI.h:82
The runtime container (one OS process/node context) hosting Psyclone components.
Definition PsySpace.h:164

Definition in file PsySpace.h.

Macro Definition Documentation

◆ LOG_SPACE

#define LOG_SPACE   7

◆ PROCMESSAGE

#define PROCMESSAGE   0

Ordinary trigger-message processing.

Definition at line 140 of file PsySpace.h.

◆ PROCREQUEST

#define PROCREQUEST   2

Query/request processing.

Definition at line 142 of file PsySpace.h.

◆ PROCSIGNAL

#define PROCSIGNAL   1

Signal processing.

Definition at line 141 of file PsySpace.h.