![]() |
|
[.NET] [tut] aSync methood - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151) +---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118) +---- Thread: [.NET] [tut] aSync methood (/showthread.php?tid=1304268) |
[tut] aSync methood - DragQueen - May 19, 2011 some knowledge about function every time u running function its block ur program until it finish that it go to next line in ur code .... well there is other function from second type its even exist from dos batch files [start "" /b ...] that dont block ur program. they work in background and ur program go to next line in code and dont wait until function over it can be done by using Thread class, new thread(Go).Start(1); or by homemade methood here some examples 'http://msdn.microsoft.com/en-us/library/system.net.webclient.downloadfileasync(v=vs.80).aspx' this function will download your file in backgrownd and program will move to next line in ur code while file is downloaded <!> 'http://msdn.microsoft.com/en-us/library/system.net.webclient.downloadfile(v=vs.80).aspx' but this function in diffrent, it will wait until u will download ur file and later or by exeption ur program will move next code and here more complex examples 'http://msdn.microsoft.com/en-us/library/system.windows.forms.control.begininvoke.aspx' and there is more samples like that one this will run somthing on main thread of ur control but it will run in background and not block ur application 'http://msdn.microsoft.com/en-us/library/system.io.stream.beginread.aspx' or like this one [with callback function] this one will wait for incoming data and if u give it callBack function when data avilible to read it will call ur callBack function [it actually pointer to the function] and when the callback func is up, it run in diffrent thread and not block ur program but no matter what happen your program will go to next line of the code for some of this function u will have to use delegate so in any case of made a delegate of some type press f12 on the delegate function, see the defination and make similier function with same return type & paramaeters and use it as callback 🤗 * - Ethereal - May 19, 2011 1. It's 'TuT', not 'tet'. 2. Formatting would be nice. 3. Wasn't a great explanation of multi-threading. Good effort, though you missed out delegates. * - Ethernal Five - May 19, 2011 LOL tet is dutch slang for tits : ) * - DragQueen - May 19, 2011 (May 19, 2011 01:17 PM)Ethereal Wrote: 1. It's 'TuT', not 'tet'. http://www.albahari.com/threading/ great site to learn multi thread [now you break your head :P] |