The above is correct but not optimal, the compiler could optimize and e.g. use a
threadpool rather than creating a new thread each time. One could think of
attributes that say which threadpool to use (other than 'default'), and some
mechanism to declare which threadpools there are (and how many threads they
contain)
Something like:
async( "ThreadPool1" ) PostEvent( /* params */ ) {
..
}
and a deployment descriptor like
<deployment>
<threadpool name="ThreadPool1" maxthreads="10" initialthreads="3"/>
</deployment>