"Fossies" - the Fresh Open Source Software Archive
Member "muscle/html/muscle-by-example/docs/pulsenode.md" (8 Jun 2019, 6449 Bytes) of package /linux/privat/muscle7.30.zip:
As a special service "Fossies" has tried to format the requested source page into HTML format (assuming markdown format).
Alternatively you can here view
the uninterpreted source code file.
A member file download can also be achieved by clicking within a package contents listing on the according byte size field.
muscle::PulseNode class (API)
PulseNode is an interface inherited by classes that may want to get their Pulse() callback-method called at various times they specify via their GetPulseTime() method.
- An object that subclasses PulseNode may reimplement its GetPulseTime() method to return a time (in 64-bit GetRunTime64()-style microseconds) at which its Pulse() method should be called next (or it can return MUSCLE_TIME_NEVER if it doesn’t currently want Pulse() to be called).
- At the scheduled time that was returned by GetPulseTime() (or very shortly thereafter) Pulse() will be called.
- This only works if the object is attached to event loop whose PulseNodeManager (typically the ReflectServer) is implemented to perform the necessary Pulse() calls.
- If the object changes its mind about when Pulse() should be called next, it should call InvalidatePulseTime() to let the PulseNodeManager know it needs to call GetPulseTime() again to get the new next-pulse-scheduled-for time. (Exception: this isn’t necessary inside Pulse() itself, since GetPulseTime() will always be called after a call to Pulse())
- Built-in classes that offer GetPulseTime()/Pulse() callbacks include: ReflectServer, ReflectSessionFactory, AbstractReflectSession, AbstractMessageIOGateway, AbstractSessionIOPolicy
- When reimplementing GetPulseTime() and Pulse(), be sure to call up to the parent class’s implementation of those methods in order not to break the parent-class’s internal Pulse-callback-functionality. (Combine your GetPulseTime() return-value with the superclass-method’s return-value by returning the minimum of the two values (e.g. via
- If a subclass of PulseNode wants to offer PulseNodeManager-style GetPulseTime()/Pulse() service to other objects that it owns, it can do so easily, just by subclassing those objects from PulseNode as well, and calling PutPulseChild() on each object once, to add the object to its PulseNodeManager’s callback-list.
Try compiling and running the mini-example-programs in
make to compile example_*, and then run each from Terminal while looking at the corresponding .cpp file)
Quick links to source code of relevant MUSCLE-by-example programs: