Solved threading

Posted on 2012-03-12
Last Modified: 2012-03-20
I have a long running process.  My plan is to create a page which will execute the process which creates a file.  The page will kick off a thread the return to the user and not wait for it to finish.  The page will have some javascript that will keep pinging the server with a web method.  When the file is created, the webservice will return the url of the file.

1. How can I kick off the thread so that the file is created without waiting for a  callback?  Is there an easy way to kick it off then leave?

2. Is this a good method?  Should I do something else.
Question by:jackjohnson44
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 75

Accepted Solution

käµfm³d   👽 earned 500 total points
ID: 37712032
How can I kick off the thread so that the file is created without waiting for a  callback?  Is there an easy way to kick it off then leave?
If you create a Thread object within your page, then call its Start method, execution will continue without blocking, unless you call Join at some point.

2. Is this a good method?  Should I do something else.
I guess that depends on whether or not you have structured this such that a subsequent request to the page won't try to write the file whilst another thread is doing so. Have you guaranteed that two threads won't compete with each other?

Author Comment

ID: 37714869
Thanks for the response.  I am actually going to pass up a guid and create a file based on that so it should be unique.

a little more info:
I am creating an excel document which could be quite large.  My plan was to load the page which will kick off the process then immediately return to the user and display a "loading" message.  The plan was to keep ping-ing my server using jQuery and search for the file using the name (guid) that I have.  When it finds it, display a link for downloading.  Make sense?

Featured Post

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question