class CAVERNplus_callSequencer_c

Class for enforcing serial processing in CAVERNsoft

Public Methods

CAVERNplus_callSequencer_c ()
Constructor.
void enterCall ()
Call this before doing work inside the callback function.
void exitCall ()
Call this when you are about to exit from the callback function.
void permitCall (int delay=3)
Choose a point where an external callback is allowable
~CAVERNplus_callSequencer_c ()
Destructor.

Documentation

Class for enforcing serial processing in CAVERNsoft.

This class is a convenience for people who are trying to retrofit previously developed applications with CAVERNsoft. Often times programs are not written with concurrent processing in mind. CAVERNsoft makes extensive use of concurrent programming and so problems may arise when attempting to retrofit the non-concurrent application with CAVERNsoft. For complex programs this is particularly difficult because there could be many inter-acting variables.

One simple solution to this problem is to force CAVERNsoft to work sequentially too (it's not efficient but for some applications it may be the only course of action.)

The way to do this is to assign a location in your program where you think CAVERNsoft callbacks are safe to occur. Using the CAVERNplus_callSequencer_c class you can declare that point in the program by using the permitCall() member function.

Then from within the callback you can call the enterCall() and exitCall() member functions. Call the enterCall() before doing any work in your callback and do an exitCall() before exiting your callback. Remember to perform the exitCall() function or else your callback will block preventing CAVERNsoft from launching any future calls to this function.

An example of a main() function of a program might be:


CAVERNplus_callSequencer_c *seq;

main() {

	blah....

	blah....

	// Do this after CAVERNsoft has been initialized.
	seq = new CAVERNplus_callSequencer_c;

	while(1) {
		do stuff...

		seq->permitCall();
	}
}

The callback might look like this:


callback() {
	seq->enterCall();

	blah....

	seq->exitCall();
}

This concept is similar to monitors however unlike monitors the call sequencer mechanism does not explicitly guarantee mutual exclusion for every variable that is accessed within the callback.

void permitCall(int delay=3)
Choose a point where an external callback is allowable
Parameters:
delay - - the amount of time to wait for a callback to be detected.


This class has no child classes.

alphabetic index hierarchy of classes


this page has been generated automatically by doc++

(c)opyright by Malte Zöckler, Roland Wunderling
contact: doc++@zib.de