Jon, it's be nice if you would update your Multi-threading in .NET
article using 3.5 features.
Thanks 6 1628
sasha <ab*********@gmail.comwrote:
Jon, it's be nice if you would update your Multi-threading in .NET
article using 3.5 features.
I don't know of many new features in .NET 3.5 with respect to
threading, to be honest. There's plenty I'd like to do in terms of
BackgroundWorker, and I suppose the examples could use C# 3.0 features
such as lambda expressions, but what were you particularly thinking of
from .NET 3.5?
I don't know when I'll get round to it, to be honest - it would be nice
to do, but I'm pretty busy :(
--
Jon Skeet - <sk***@pobox.com>
Web site: http://www.pobox.com/~skeet
Blog: http://www.msmvps.com/jon.skeet
C# in Depth: http://csharpindepth.com
On Sun, 2 Nov 2008 22:43:52 -0000, Jon Skeet [C# MVP]
<sk***@pobox.comwrote:
>sasha <ab*********@gmail.comwrote:
>Jon, it's be nice if you would update your Multi-threading in .NET article using 3.5 features.
I don't know of many new features in .NET 3.5 with respect to threading, to be honest. There's plenty I'd like to do in terms of BackgroundWorker, and I suppose the examples could use C# 3.0 features such as lambda expressions, but what were you particularly thinking of from .NET 3.5?
I don't know when I'll get round to it, to be honest - it would be nice to do, but I'm pretty busy :(
I was just wondering if BackgroundWorker will be updated to provide
more graceful exit of the background thread. Any provision for
synchronizing the abort so the threaded process can organize file
closes, etc.?
I was just wondering if BackgroundWorker will be updated to provide
more graceful exit of the background thread. Any provision for
synchronizing the abort so the threaded process can organize file
closes, etc.?
I'm fairly certain nothing has changed in those areas. And even if it
had, it would most likely be ".NET 2.0 SP {x}", rather than .NET 3.5
itself. Re "synchronizing the abort" - I'm not entirely sure what you
mean, but you can subscribe to RunWorkerCompleted, which will fire (on
success, cancellation or failure, which you can determine from the
event-args) on the UI thread.
Marc
"Marc Gravell" <ma**********@gmail.comwrote in message
news:16**********************************@v22g2000 pro.googlegroups.com...
>I was just wondering if BackgroundWorker will be updated to provide more graceful exit of the background thread. Any provision for synchronizing the abort so the threaded process can organize file closes, etc.?
I'm fairly certain nothing has changed in those areas. And even if it
had, it would most likely be ".NET 2.0 SP {x}", rather than .NET 3.5
itself. Re "synchronizing the abort" - I'm not entirely sure what you
mean, but you can subscribe to RunWorkerCompleted, which will fire (on
success, cancellation or failure, which you can determine from the
event-args) on the UI thread.
Marc
From the MSDN Lib:
"You must be careful not to manipulate any user-interface objects in your
DoWork event handler. Instead, communicate to the user interface through the
ProgressChanged and RunWorkerCompleted events."
I found this out the hard way. If you do anything to the UI in the DoWork
you run the risk of causing problems. And it won't report any error either,
the BackgroundWorker will just abruptly and silently abort operation and
jump to the next piece of code leaving you to scratch your head.
Eric B.
"You must be careful not to manipulate any user-interface objects in
your DoWork event handler. Instead, communicate to the user interface
through the ProgressChanged and RunWorkerCompleted events."
Or through suitable use of Control.Invoke; but yes: ProgressChanged and
RunWorkerCompleted make life a lot easier.
Actually, in debug it *might* tell you about the problem (cross-thread
etc) - but only if you get lucky ;-p
And if it fails, it won't do it completely silently: it will raise
RunWorkerCompleted with an argument that contains an exception.
Marc
"Marc Gravell" <ma**********@gmail.comwrote in message
news:eC**************@TK2MSFTNGP03.phx.gbl...
>"You must be careful not to manipulate any user-interface objects in your DoWork event handler. Instead, communicate to the user interface through the ProgressChanged and RunWorkerCompleted events."
Or through suitable use of Control.Invoke; but yes: ProgressChanged and
RunWorkerCompleted make life a lot easier.
Actually, in debug it *might* tell you about the problem (cross-thread
etc) - but only if you get lucky ;-p
And if it fails, it won't do it completely silently: it will raise
RunWorkerCompleted with an argument that contains an exception.
Marc
In my experience it never jumped to RunWorkerCompleted, at least not while
stepping through the code in debug mode.
Eric B. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Anthony_Barker |
last post by:
I have been reading a book about the evolution of the Basic
programming language. The author states that Basic - particularly
Microsoft's version is full of compromises which crept in along the...
|
by: Egor Bolonev |
last post by:
hi all
my program terminates with error i dont know why it tells 'TypeError:
run() takes exactly 1 argument (10 given)'
=program====================
import os, os.path, threading, sys
def...
|
by: Jon Skeet [C# MVP] |
last post by:
Please excuse the cross-post - I'm pretty sure I've had interest in the
article on all the groups this is posted to.
I've finally managed to finish my article on multi-threading - at least
for...
|
by: Vjay77 |
last post by:
In this code:
Private Sub downloadBtn_Click(ByVal sender As Object, ByVal e As
System.EventArgs)
If Not (Me.downloadUrlTextBox.Text = "")
Then
Me.outputGroupBox.Enabled = True...
|
by: gokkog |
last post by:
Hi there,
There's a classic hash function to hash strings, where MULT is defined
as "31":
//from programming pearls
unsigned int hash(char *ptr)
{ unsigned int h = 0;
unsigned char *p =...
| |
by: GaryDean |
last post by:
I have serveral applications now running that are using the
MembershipProvider classes and they are each using their own security tables
in SQL Server 2005 instead of the express databases - they...
|
by: Dann Corbit |
last post by:
Rather than create a new way of doing things:
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2497.html
why not just pick up ACE into the existing standard:...
|
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,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
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...
| |
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...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
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...
| |