473,594 Members | 2,812 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Re: Please suggest a Generic Cross-Thread Safe Invocation technique

On Thu, 26 Jun 2008 03:35:58 -0700, DeveloperX
<ia************ @googlemail.com wrote:
Hello, this came up a few days ago, well similar. I suggested
Synchronization Context briefly, I've found a blog post which explains
the ThreadBarrier pattern and may be of use.

http://blog.quantumbitdesigns.com/20...threadbarrier/

and also

http://blog.quantumbitdesigns.com/20...ier-revisited/
I think these articles are informative and useful food for thought.
However, they don't seem to really be applicable here, and I definitely
disagree with the implication that a) using Invoke() is "polluting the UI
thread" and especially b) that the proposed alternative, using the
Synchronization Context class, avoids "polluting the UI thread". If
there's a pollution problem (and I don't feel that there is), the
Synchronization Context approach has exactly the same problem that
Control.Invoke( ) does (seeing as they both wind up using the same
mechanisms).

In this particular message thread, there is a specific need to execute the
code on the GUI thread. There's no way around that. The simplest, most
straightforward way to do that is to simply call Invoke() with an
anonymous method that contains the code that needs to be executed.

It's good for people to know that Synchronization Context exists and how to
use it. But in reality, Control.Invoke( ) (or Control.BeginIn voke()) is
sufficient and perfectly appropriate for most needs.
Peter, Google groups is working in Opera again :D
Yay! :) Still, you might eventually find that using a real newsreader is
better. :)

Pete
Jun 27 '08 #1
1 1672
On Jun 26, 7:30*pm, "Peter Duniho" <NpOeStPe...@nn owslpianmk.com>
wrote:
On Thu, 26 Jun 2008 03:35:58 -0700, DeveloperX *

<ianathomeag... @googlemail.com wrote:
Hello, this came up a few days ago, well similar. I suggested
Synchronization Context briefly, I've found a blog post which explains
the ThreadBarrier pattern and may be of use.
http://blog.quantumbitdesigns.com/20...ting-the-ui-th...
and also
http://blog.quantumbitdesigns.com/20...g-ui-and-worke...

I think these articles are informative and useful food for thought. *
However, they don't seem to really be applicable here, and I definitely *
disagree with the implication that a) using Invoke() is "polluting the UI*
thread" and especially b) that the proposed alternative, using the *
Synchronization Context class, avoids "polluting the UI thread". *If *
there's a pollution problem (and I don't feel that there is), the *
Synchronization Context approach has exactly the same problem that *
Control.Invoke( ) does (seeing as they both wind up using the same *
mechanisms).

In this particular message thread, there is a specific need to execute the *
code on the GUI thread. *There's no way around that. *The simplest, most *
straightforward way to do that is to simply call Invoke() with an *
anonymous method that contains the code that needs to be executed.

It's good for people to know that Synchronization Context exists and how to *
use it. *But in reality, Control.Invoke( ) (or Control.BeginIn voke()) is*
sufficient and perfectly appropriate for most needs.
Peter, Google groups is working in Opera again :D

Yay! *:) *Still, you might eventually find that using a real newsreader is *
better. *:)

Pete
Yep I take that on board, I've been playing with it in a mix of UI and
non UI contexts so it's quite interesting to me. I was semi wrong
about Opera being fixed. It works in standard view, but not tree view.
I'd love to use a real newsreader, but our pesky firewall is in the
way :( Fine at home of course.
Jun 27 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2274
by: napsters | last post by:
Google uses some javascript for their Google Suggest service (http://www.google.com/webhp?complete=1&hl=en). When you type 'whatever', the script (http://www.google.com/ac.js, or, more readable, http://www.romanzieri.com/google_suggest.js) calls http://www.google.com/complete/search?hl=en&js=true&qu=whatever. It looks a bit like LiveSearch, which has a hell of a cleaner script (http://blog4.bitflux.ch/wiki/LiveSearch#Source_Code, demo at...
1
995
by: Lloyd Dupont | last post by:
due to cross reference I need to separate declaration and implementation. in my header I have something like that: --StyledRange.h-- generic <class T> ref class StyledRange; generic <class T> public ref class StyledItem { StyledItem(StyledRange<T>^ r, int pos, int len); }
5
1623
by: DelphiAddict | last post by:
Hi. Has anyone looked into generic factoring for making database independant applications? (Framework 2.0) I have, but I'm in the starting fase. What I do know is that if you only write code, you are able to make fairly database independant applications with not much more effort that
3
2082
by: ricolee99 | last post by:
Hi everyone, I have a problem that i have been trying to solve for awhile. I'm given a code where the purpose is to create a general dataset mapper. Given any dataset, i have a class, "Mapper.cs" that's supposed to map objects from any type of dataset to any type of object. Inside Mapper.cs, there's a method, object Map(Type typeOfObjectToMap, DataSet theDataSet)
8
1695
by: | last post by:
I'm looking for some design guidance on a collection of projects I'm working on. The project involves a bunch of websites constructed out of a collection of user controls. Different user populations with different access rights and "roles" will be visiting the site. I will be using ASP.NET 2.0's membership, roles, and profiles stuff to manage access. User controls need to be visible or not visible depending on user role. In some...
15
7554
by: Giggle Girl | last post by:
Hello there, :) I need a frameset that will have the same look and behavior in Firefox 1.5+ as it does in IE 6+. Here is a URL for it: http://66.51.164.93/fs/default.htm In IE, the "seam" between the three frames is blue, 4 or 5 pixels wide, and -- most importantly! -- draggable! It is great -- in IE, that is. Is it possible to have this same look and behavior in Firefox?
3
4991
by: Vincent Finn | last post by:
Hi, I am trying to write a generic function and it isn't behaving as expected. I want to avoid having to write custom convert functions for my enums so I want to convert to an int and cast to the enum, this wouldn't compile so I tried a few variations. The cast fails inside the generic function even though its valid. The code below is the simplest example of the problem I could think of, even casting int to int fails.
0
1203
by: shapper | last post by:
Hello, I want to create an ordered list where each list item can have various controls: <ol> <li>textbox, label, ...</li> ... </ol>
15
2133
by: Prisoner at War | last post by:
Okay, I'd like to create a print-friendly website, so I've been reading up on how to create print-friendly pages (without duplicating my site, of course, by having separate versions of each page).... Apparently one can use JavaScript or CSS for this.... Using CSS, it seems that the "trick" is to use * media="print" * in the <linktag.... So if I have a hyperlink to a print-friendly page...um, well, what's
32
5640
by: copx | last post by:
Why doesn't the C standard include generic function pointers? I use function pointers a lot and the lack of generic ones is not so cool. There is a common compiler extension (supported by GCC and lccwin32 for example) which I consider to be perfectly reasonable: you can cast every kind of function pointer to a void pointer and void pointers to any kind of function pointer. This follows the general "generics through void scheme" of C....
0
7877
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8009
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
5739
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5411
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3867
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
3903
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2389
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1482
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1216
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.