Wednesday, August 1, 2007

New ThreadSynch released, now with asynchronous call support

As part of a series of tune-ups, bug-fixes and feature additions in the ThreadSynch library, I've made a fresh release available at googlecode.com. The 0.8.0 source contains support for asynchronous completion of cross thread calls, with return value assignment to "Future"-objects (and the same exception-rethrowing as before). See the change log included in the source package for more information.

I have yet to update the CodeProject article, which serves as somewhat of an "how to", but that will be done within a few days.

While I consider 0.8.0 to be pretty stable, there's still work waiting to be done on the asynchronous interfaces. I will attempt to keep breaking changes at a minimum, but I believe heavy use will uncover smoother ways of dealing with call completion guarantees. With the current mechanics, an asynchronous call waiting to begin can be aborted through calling a function on the future-object, or letting the future-object fall out of scope. If the abort function is called after execution has begun, it will not return until it has completed (in other words: it won't be aborted). If exceptions are thrown during the execution, they will be re-thrown from the abort-function (or alternatively getReturnValue). Should the future object fall out of scope, the destructor will wait for a begun call to complete, or abort a call waiting to begin, but not re-throw any exceptions should one be caught in the target thread. This approach seems reasonable, but it's not perfect, so I'll have to spend more time looking into that later. I think I'll cover the problem more extensively in the upcoming codeproject article as well, so if you're interested; turn to that. In the mean-time, see the examples included in the source package.

0 kommentarer: