473,396 Members | 1,774 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

"Posting" to GUI Thread from Background Thread

I'm working on an app which uses a background thread to read data from
a socket.

At the moment I'm doing something a bit "naughty" -- I'm firing an
event after reading from the socket, and this event gets picked up by
an event handler in the GUI thread, without "synchronizing" with this
GUI thread.

How can I "synchronize" threads in .NET?
Nov 15 '05 #1
3 9380
MSDN Mag (Feb 03) issue has an excellent article on threads for responsive
UI -
http://msdn.microsoft.com/msdnmag/is...g/default.aspx

Hope that helps.
SBC
"C# Learner" <cs****@learner.here> wrote in message
news:3d********************************@4ax.com...
I'm working on an app which uses a background thread to read data from
a socket.

At the moment I'm doing something a bit "naughty" -- I'm firing an
event after reading from the socket, and this event gets picked up by
an event handler in the GUI thread, without "synchronizing" with this
GUI thread.

How can I "synchronize" threads in .NET?

Nov 15 '05 #2
C# Learner <cs****@learner.here> wrote:
I'm working on an app which uses a background thread to read data from
a socket.

At the moment I'm doing something a bit "naughty" -- I'm firing an
event after reading from the socket, and this event gets picked up by
an event handler in the GUI thread, without "synchronizing" with this
GUI thread.

How can I "synchronize" threads in .NET?


Use Control.Invoke to run a delegate in the GUI thread associated with
a specific control.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 15 '05 #3
C# Learner <cs****@learner.here> wrote:

<snip>

Thanks guys.
Nov 15 '05 #4

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

Similar topics

33
by: Steven Bethard | last post by:
I feel like this has probably been answered before, but I couldn't find something quite like it in the archives. Feel free to point me somewhere if you know where this has already been answered. ...
3
by: Barry Pearson | last post by:
I'm posting here because this is associated with the behaviour of a floated element. It has similarities to the IE 6 (on Windows) "peekaboo" bug, and I suspect was written by the same coder having...
3
by: John | last post by:
Hi, I have a class which on instantiation creates a background thread to do its processing in. The class exposes a number of events that the application subscribes to so that data can be...
5
by: Mike Logan | last post by:
I used WSDL.exe to generate a client side web proxy for a web service, called the web service, got the results but an array returned by the web service is not in the results. However if I use...
6
by: tony | last post by:
Is it possible to use the post method to send a form from PHP without having to put the form in a html page? <form action="https://www.mysite.com/cgi/incoming.php" method="post"> <input...
3
by: jpa770 | last post by:
3 employee's will be responsible for installing and maintaining IBM product set to include but not limited to Tivoli Access Manager 6.0, IBM Websphere Application Server, IBM MQ Server, and IBM DB2...
7
by: Abhinay | last post by:
hi, sorry for asking this question in this forum, but i did't found any contact of concern person. My que is still unanswered so i wanted to post a message to my thread as per Posting...
4
by: webandwe | last post by:
Hi I have a field box that will be used for GPS co-ordinates. But the " and ' mess my mysql query up. My code work like this. $a1=$_POST; query = "INSERT INTO information VALUES...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...

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.