
Signature
Carlos Redondo
.Net Developer
> Hi guys,
> I'm using delegates to execute a group of methods using the BeginInvoke,
[quoted text clipped - 10 lines]
> return dDecrypt->EndInvoke(dDecrypt->BeginInvoke(Data,new
> System::AsyncCallback(this,DelegateCallback),dDecrypt));
Well, to answer the question you asked in the subject line but left out of
the body, don't use Managed Extensions for C++. Not ever. It's buggy and
Microsoft will not be fixing it.
If you're just calling EndInvoke immediately, why are you using an
asynchronous call at all? It's just adding more overhead due to thread
synchronization and context switching.
Managed Extensions for C++ probably would have used "NULL" though, if it
wasn't too buggy to do anything reliably.
Charlie - 25 Oct 2007 23:32 GMT
> If you're just calling EndInvoke immediately, why are you using an
> asynchronous call at all? It's just adding more overhead due to thread
> synchronization and context switching.
Good point, but the reason is that I need to execute the logic on a
different thread, since I'm consuming the C++ .Net Object from a complex ERP
(JDEdwards) thread and this particular thread has particular specifications
that force me to use a different thread to execute my logic.
Also, I found that I can't (I mean, I can but I shouldn't) execute the
EndInvoke immediately as I pasted on my first post, I have to wait for the
async thread to be completed to (them) call the EndInvoke.
//BeginInvoke()
while(!ar->IsCompleted)
{ar->AsyncWaitHandle->WaitOne(1, false);}
//EndInvoke()
For now my BeginInvoke Callback method is just a declaration (no code
inside)... but I just want to have a clean source code.

Signature
Carlos Redondo
.Net Developer
> > Hi guys,
> > I'm using delegates to execute a group of methods using the BeginInvoke,
[quoted text clipped - 21 lines]
> Managed Extensions for C++ probably would have used "NULL" though, if it
> wasn't too buggy to do anything reliably.