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 / Windows Forms / WinForm General / July 2004

Tip: Looking for answers? Try searching our database.

BeginInvoke and EndInvoke - Is EndInvoke necessary?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Robert Conde - 19 Jul 2004 16:38 GMT
Hi,
  I'm calling my ui from a thread which is different from the ui thread.
Accordingly I need to use the BeginInvoke or Invoke functions. Now I'd
rather the calls be non-blocking so I'd like to use BeginInvoke. But the
documentation says "CAUTION   Always call EndInvoke after your asynchronous
call completes."  Is this really necessary? I don't need a result. I just
want to use it like PostMessage. It's gonna be a pain to hold the asynch
result and call EndInvoke somehow. It seems to be working without calling
EndInvoke, but I don't want it creeping up on me later.

Rob Conde
a.i. solutions
Herfried K. Wagner [MVP] - 19 Jul 2004 17:38 GMT
* "Robert Conde" <conde@ai-solutions.com> scripsit:
>    I'm calling my ui from a thread which is different from the ui thread.
> Accordingly I need to use the BeginInvoke or Invoke functions. Now I'd
[quoted text clipped - 4 lines]
> result and call EndInvoke somehow. It seems to be working without calling
> EndInvoke, but I don't want it creeping up on me later.

Currently, you don't need to call 'EndInvoke', but maybe there will be
problems/leaks if you don't call it in future versions of .NET.

Signature

Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
<URL:http://dotnet.mvps.org/dotnet/faqs/

Jon Skeet [C# MVP] - 19 Jul 2004 17:58 GMT
> * "Robert Conde" <conde@ai-solutions.com> scripsit:
> >    I'm calling my ui from a thread which is different from the ui thread.
[quoted text clipped - 8 lines]
> Currently, you don't need to call 'EndInvoke', but maybe there will be
> problems/leaks if you don't call it in future versions of .NET.

Not for UI calls - I believe the WinForms team has basically guaranteed
that EndInvoke isn't required for UI calls. For all other async
Begin/EndXXX pairs, you should call EndXXX.

Signature

Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too


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.