How to use a thread to respond a web request?

P

Polaris

Hi:

I have some lengthy operations need to be finished before I can respond to
client's request. Just wonder, is it possible to use a thread of my own to
respond to client's web request? As a result, the client's request will not
be blocked by the lengthy operation, when the thread gets client's request
it will respond to the client request using only available existing results
without waiting for the lengthy operation to finish. I tried to put the
lngthy operation in a thread but found out that it did not take full
advantage of the CPU cycles even I set the scheduling priority to the
heighest.

Thanks for any info.
 
A

Alvin Bruney

why don't you have the main thread respond to the client request and do the
lengthy request on a worker thread. This way, the main thread, UI thread, is
always available to cause the application to be reponsive while work is
being done in the back ground.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top