c# - Is new Thread(() => {//logic}).Start(); acceptable for executing logic "asynchronously" in web apps page_load -
(I use the word "asynchronous" with a loose word)
I'm using For the initial session reference information to save the DB, the code below for a while, such as the affiliate details for later tracking. I have suggested to others to speed up some of our procedures to use this concept, but I hate to give some suggestions that are potentially dangerous.
I want to know whether it is acceptable or there are some threading problems I will cause most traffic times later due to the road? All my arguments to save information to the new thread ((=) {// DB}} {name = "My long moving page process", Iibground = true, priority = Thread priority. General}. Start ();
update
Thanks! After the reply of David Basir, I think this would be my new method:
action Some process = () = & gt; {// you dB work}; SomeLongProcess.BeginInvoke ((x) => {someLongProcess.EndInvoke (x); // Can}}, tap);
I will use the thread pool because instead of creating a new one for each request Threads use predefined pools and it gives you a true assync by highlighting a callback.
You can use only the action rep and call Banginwoolk, which is the thread pool in the background .
Actions SomeLongProcess = () = & gt; {// You DB Car If}; async callback callback = (R) = & gt; {// Now it is done that you can do anything or pass the tap to do anything); Some process. Bizinok (callback, blank);
Comments
Post a Comment