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

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Run tasks synchronously in background thread 19 82
Call to SQL server times out 5 56
Easiest intro into .NET CORE? 2 34
SQL State HYT00. Timeout expired proplem 8 45
ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
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…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

752 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