Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / October 2007

Tip: Looking for answers? Try searching our database.

nullptr for VS2005 but what about VS2003?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Charlie - 25 Oct 2007 03:43 GMT
Hi guys,
I'm using delegates to execute a group of methods using the BeginInvoke,
that works fine; I'm waiting for the asynch thread to return the response
using the EndInvoke, that works fine also.  The point is, I didn't find the
way to pass a null value to the BeginInvoke method for the AsyncCallback and
object argument.  I don't want to have unused code on my source code, but I
didn't find the way to avoid it.  
Any thoughts?

return dDecrypt->EndInvoke(dDecrypt->BeginInvoke(Data,new
System::AsyncCallback(this,DelegateCallback),dDecrypt));
Signature

Carlos Redondo
.Net Developer

Ben Voigt [C++ MVP] - 25 Oct 2007 15:32 GMT
> 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.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.