473,394 Members | 1,737 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,394 software developers and data experts.

Is this the correct Multi-threading approach

Hi,
I need to kick off a long running process in response to a user action
on my website. I'm not fussed whether it completes correctly or not (it's
just sends a load of emails) but I want control of the webpage to return
immediately to the user.

So all I do in my Server side event handler for the page is :

SiteUsers su = new SiteUsers();
Thread background = new Thread(new ThreadStart(su.EmailUsers));

background.Start();

Will this give me any undesirable side effects in ASP.NET? As I said earlier
I don't care if it completes or not so I've not used any Callback to tell me
when it's done.

thanks

Pete
Nov 18 '05 #1
5 834
Should be just fine.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Pete" <peted "at" xboxracing dot net> wrote in message
news:eA*************@TK2MSFTNGP11.phx.gbl...
Hi,
I need to kick off a long running process in response to a user action on my website. I'm not fussed whether it completes correctly or not (it's
just sends a load of emails) but I want control of the webpage to return
immediately to the user.

So all I do in my Server side event handler for the page is :

SiteUsers su = new SiteUsers();
Thread background = new Thread(new ThreadStart(su.EmailUsers));

background.Start();

Will this give me any undesirable side effects in ASP.NET? As I said earlier I don't care if it completes or not so I've not used any Callback to tell me when it's done.

thanks

Pete

Nov 18 '05 #2
"Kevin Spencer" <ke***@takempis.com> wrote in message
news:et**************@TK2MSFTNGP09.phx.gbl...
Should be just fine.


Should be just fine assuming that the new thread doesn't reference anything
from the page which spawned it, or from the current request.
--
John Saunders
John.Saunders at SurfControl.com
Nov 18 '05 #3
Thanks for the answers guys. Just wanted to double check my sanity.

Pete
"John Saunders" <john.saunders at SurfControl.com> wrote in message
news:Or**************@TK2MSFTNGP10.phx.gbl...
"Kevin Spencer" <ke***@takempis.com> wrote in message
news:et**************@TK2MSFTNGP09.phx.gbl...
Should be just fine.
Should be just fine assuming that the new thread doesn't reference

anything from the page which spawned it, or from the current request.
--
John Saunders
John.Saunders at SurfControl.com

Nov 18 '05 #4
Just a thought Pete - what happens if its accessed by many users - will it
kill your box? In theory it should work fine, however if it was me I would
look at putting this into a windows service and using the web service to do
nothing more than log a job request. That was there is no risk whatsoever
to your web server.

--
Regards

John Timney (Microsoft ASP.NET MVP)
----------------------------------------------
<shameless_author_plug>
Professional .NET for Java Developers with C#
ISBN:1-861007-91-4
Professional Windows Forms
ISBN: 1861005547
Professional JSP 2nd Edition
ISBN: 1861004958
Professional JSP
ISBN: 1861003625
Beginning JSP Web Development
ISBN: 1861002092
</shameless_author_plug>
----------------------------------------------

"Pete" <peted "at" xboxracing dot net> wrote in message
news:#I**************@TK2MSFTNGP12.phx.gbl...
Thanks for the answers guys. Just wanted to double check my sanity.

Pete
"John Saunders" <john.saunders at SurfControl.com> wrote in message
news:Or**************@TK2MSFTNGP10.phx.gbl...
"Kevin Spencer" <ke***@takempis.com> wrote in message
news:et**************@TK2MSFTNGP09.phx.gbl...
Should be just fine.


Should be just fine assuming that the new thread doesn't reference

anything
from the page which spawned it, or from the current request.
--
John Saunders
John.Saunders at SurfControl.com


Nov 18 '05 #5
Yeah, I'd thought of that but for the time being at least the area is very
low use (i wanted the threading more for positive user perception, nothing
worse than a page that takes 5 seconds or more...).

The other issue I have is that I'm running on a Discount ASP.NET provider
who doesn't let me do too much so I need to be a bit creative to fix some
limitations ;) in server accessibility
Thanks for the heads-up though

Regards

Pete
"John Timney (Microsoft MVP)" <ti*****@despammed.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Just a thought Pete - what happens if its accessed by many users - will it
kill your box? In theory it should work fine, however if it was me I would look at putting this into a windows service and using the web service to do nothing more than log a job request. That was there is no risk whatsoever
to your web server.

--
Regards

John Timney (Microsoft ASP.NET MVP)
----------------------------------------------
<shameless_author_plug>
Professional .NET for Java Developers with C#
ISBN:1-861007-91-4
Professional Windows Forms
ISBN: 1861005547
Professional JSP 2nd Edition
ISBN: 1861004958
Professional JSP
ISBN: 1861003625
Beginning JSP Web Development
ISBN: 1861002092
</shameless_author_plug>
----------------------------------------------

"Pete" <peted "at" xboxracing dot net> wrote in message
news:#I**************@TK2MSFTNGP12.phx.gbl...
Thanks for the answers guys. Just wanted to double check my sanity.

Pete
"John Saunders" <john.saunders at SurfControl.com> wrote in message
news:Or**************@TK2MSFTNGP10.phx.gbl...
"Kevin Spencer" <ke***@takempis.com> wrote in message
news:et**************@TK2MSFTNGP09.phx.gbl...
> Should be just fine.

Should be just fine assuming that the new thread doesn't reference

anything
from the page which spawned it, or from the current request.
--
John Saunders
John.Saunders at SurfControl.com



Nov 18 '05 #6

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

Similar topics

4
by: Frank Jona | last post by:
Intellisense with C# and a multi-file assembly is not working. With VB.NET it is working. Is there a fix availible? We're using VisualStudio 2003 Regards Frank
12
by: * ProteanThread * | last post by:
but depends upon the clique: ...
0
by: frankenberry | last post by:
I have multi-page tiff files. I need to extract individual frames from the multi-page tiffs and save them as single-page tiffs. 95% of the time I receive multi-page tiffs containing 1 or more black...
6
by: cody | last post by:
What are multi file assemblies good for? What are the advantages of using multiple assemblies (A.DLL+B.DLL) vs. a single multi file assembly (A.DLL+A.NETMODULE)?
6
by: Joe | last post by:
I have 2 multi-list boxes, 1 displays course categories based on a table called CATEGORIES. This table has 2 fields CATEGORY_ID, CATEGORY_NAME The other multi-list box displays courses based on...
4
by: mimmo | last post by:
Hi! I should convert the accented letters of a string in the correspondent letters not accented. But when I compile with -Wall it give me: warning: multi-character character constant Do the...
5
by: Shane Story | last post by:
I can seem to get the dimensions of a frame in a multiframe tiff. After selecting activeframe, the Width/Height is still really much larger than the page's actual dimensions. When I split a...
5
by: bobwansink | last post by:
Hi, I'm relatively new to programming and I would like to create a C++ multi user program. It's for a project for school. This means I will have to write a paper about the theory too. Does anyone...
0
by: Sabri.Pllana | last post by:
We apologize if you receive multiple copies of this call for papers. *********************************************************************** 2008 International Workshop on Multi-Core Computing...
1
by: mknoll217 | last post by:
I am recieving this error from my code: The multi-part identifier "PAR.UniqueID" could not be bound. The multi-part identifier "Salary.UniqueID" could not be bound. The multi-part identifier...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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...
0
tracyyun
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 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.