Click here to Skip to main content
15,889,867 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Hi have an web application and have following requirement :-

* I have one log method.
* I want to implement threading.
* After insertion i want to release the thread for next request without wait.
* Without any await for response.

how could i implement this ?
Posted
Updated 10-Dec-14 1:42am
v2
Comments
Leo Chapiro 10-Dec-14 7:29am    
What have you already achieved?
Naveen Singh 10-Dec-14 7:31am    
I have to implement on page load using REST protocol.
OriginalGriff 10-Dec-14 7:34am    
And?
What have you tried?
Where are you stuck?
What help do you need?
Use the "Improve question" widget to edit your question and provide better information.
Naveen Singh 10-Dec-14 7:59am    
I m stuck at how could i process make this method log() async ?
Praveen Kumar Upadhyay 10-Dec-14 8:05am    
Is it a WebService you are talking about. where you want to process the request in thread and release the request immediately
OR
you want some method or some peace of code to run in thread

1 solution

Use Thread in below manner.

C#
new Thread(() =>
{
      //Place your code here and this will run in a Thread
}).Start();
 
Share this answer
 
Comments
Naveen Singh 11-Dec-14 1:05am    
Thanks Praveen but should i call any async on page load and will this thread get free after every request.
Praveen Kumar Upadhyay 11-Dec-14 1:09am    
Yes of course.
Naveen Singh 11-Dec-14 1:36am    
It creates new thread for every request ?
Praveen Kumar Upadhyay 11-Dec-14 1:39am    
Yes. But do remember, if the request will take a longer time to execute then the HTTP will keep on increasing and can crash the Application Pool.
Naveen Singh 11-Dec-14 1:47am    
Because i have a huge amount of request per second .

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900