Browse Prior Art Database

Stub system to allow the calling of functions in other threads.

IP.com Disclosure Number: IPCOM000009153D
Publication Date: 2002-Aug-09
Document File: 2 page(s) / 1K

Publishing Venue

The IP.com Prior Art Database

Related People

Charles Samuels: INVENTOR [+2]

Related Documents

http://www.derkarl.org/itc/: URL

Abstract

[ IPCOM000000011S originally published 2001-08-09 17:52 UTC ] This stub system parses a C++ source file (or, any file with a "class" declaration), at compile-time to create a series of (C++) functions that, through a series of mutexes and condition variables, are able to signal a second thread into accepting the function call. The second thread can then call a function that checks a message queue for new input, and calls the given function. The first thread is able to block with a condition variable set, but optionally, functions can be declared as asynchronous by prefixing it with async (#define async void). This procedure is able to produce an easy system of calling second threads, or RTPC (Remote-Thread Procedure call). [ 000000011S 11S ]

This text was extracted from an ASCII text file.
This is the abbreviated version, containing approximately 80% of the total text.

An example header file parsed is:

class ObjectImpl : public ITC::Base

{

itcpublic:

              void function();

              async otherFunction(int x);

};

for this, a header including, but not limited to the following is produced:

class Object : public ITC::Stub

{

public:

              Object(ObjectImpl &impl);

              void function();

              void otherFunction(int x);

};

Example parsed header file:

class TestImpl : public ITC::Base, public ITC::Thread

{

itcpublic:

// this directive signifies that it is parsed

              double get()const;

             

public:

              virtual void run();

private:

              double v;

              bool mGo;

};

// implementation

void TestImpl::run()

{

              // Calculates pi

              v=0;

              double bottom=1;

             

              bool subtract=false;

             

              while (mGo)

              {

             

                            if (subtract)

                                          v-=(1.0/bottom);

                            else

                                          v+=(1.0/bottom);

                           

                            subtract=!subtract;

                            bottom+=2;

                           

                            process();

              }

}

double TestImpl::get() const

{

              return v*4;

}

// the file generated by the parser,

// contains the stub class

#include "test.itc.h"

#include <iomanip.h>

int main()

{

              TestImpl thread;

              // calls "run" in the second thread)            

              thread.start();

             

              // Test is the generated Stub clas...