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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

762 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