Big changes in pipeline for upcoming "FishTaco" release

News and Announcements

There are some big changes in store for the upcoming release. One of these is a complete revamp of the current delegate implementation in the framework. The new implementation allows for arbitrary function signatures, and for asynchronous invocation. This is the same kind of functionality found in .NET's Delegate.BeginInvoke/Delegate.EndInvoke functions.

Code for this looks something like this:

void doit( int i ) {
	printf( "Hello from doit! i: %d\n", i );
	::Sleep( 3000 );
}



Delegate1<int> d2;
d2 += doit;
d2( 100 );
You can invoke this asynchronously:
AsyncResult* ar = d2.beginInvoke( 10, NULL );

ar->wait();
ar->free();

You can get the results of an async operation:
bool duhDoIt( const String& str, double d )
{
	bool result = true;
	printf( "duhDoIt() %s, %0.5f, returning %d\n", str.ansi_c_str(), d, result );
	return result;
}



Delegate2R<bool,const String&,double> d3;

d3 += duhDoIt;
String str("hola!");
ar = d3.beginInvoke( str, 120.456, NULL );

ar->wait();

//endInvoke returns the last result
bool b = d3.endInvoke( ar );

ar->free();

Unfortunately this will also force applications to be recompiled and you may have to adjust your code a little bit. However the basic principal of how it works and how you use it is the same.

Along with this we will get new functionality in the form of a ThreadPool class for creating a pool of threads that can be assigned "work" to be performed. Also there are new threaded function wrappers that allow you to execute a function in separate thread, or pushed on a thread pool for execution.