|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
ThreadingI need more information to read about threading in Visual Basic.
Hopefully something linear w/o too many links to get lost in. I've been to http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconThreading.asp but it is too confusing. I can't find any references to STA threading model or what exactly this is doing: <STAThread()> Public Shared Sub Main(ByVal CmdArgs() As String) Application.Run(New Form1) End Sub Thanks cj,
Are you sure you need threading, as I have read from somebody active in this newsgroup and full acknowledged by me, who wrote something as. Multi threading is mostly in use by newbies who find it very interesting however don't know what to solve with it. Be aware that multithreading takes forever more processing time. Therefore start reading it when you need it, beside the more processing time makes it your program less maintainable. However if you want to read something about it, than start with the backgroundworker from version 2.0 which has at least not to much from the last problem. http://msdn2.microsoft.com/en-us/library/8xs8549b.aspx I hope this gives an idea. Cor Cor, I would not be using threading unless I thought I had to. The
company we purchased the com components from has told me that I have to use threading to make a TCP/IP server capable of handling many requests simultaneously. Sounds logical to me too. I'm trying to understand their sample programs. Cor Ligthert [MVP] wrote: Show quoteHide quote > cj, > > Are you sure you need threading, as I have read from somebody active in this > newsgroup and full acknowledged by me, who wrote something as. > > Multi threading is mostly in use by newbies who find it very interesting > however don't know what to solve with it. > > Be aware that multithreading takes forever more processing time. > > Therefore start reading it when you need it, beside the more processing time > makes it your program less maintainable. > > However if you want to read something about it, than start with the > backgroundworker from version 2.0 which has at least not to much from the > last problem. > > http://msdn2.microsoft.com/en-us/library/8xs8549b.aspx > > I hope this gives an idea. > > Cor > > CJ,
Than I would ask the question more direct on TCP/IP, this subject is already often handled in this newsgroup by the way. http://groups.google.com/group/microsoft.public.dotnet.languages.vb/search?group=microsoft.public.dotnet.languages.vb&q=TCP%2FIP+threading&qt_g=1&searchnow=Search+this+group You can as well have a look at Jon's pages. However because I have read your question, is my opinion that I think that you will not become happy from this. http://www.yoda.arachsys.com/csharp/threads/ Be aware that it is not as difficult as it looks like as you have seen these pages. I hope this helps, Cor To complement Cor's post.... If you're coming from the VB.Classic world and
need to understand threading in relation to VB.Classic's and COM's threading models, start here: http://blogs.msdn.com/jfoscoding/archive/2005/04/07/406341.aspx Then http://www.devx.com/DevX/10MinuteSolution/20365 I can give you a canned response about what Application.Run does, but this will be more informative: http://dotnet.sys-con.com/read/39039.htm Show quoteHide quote "cj" <cj@nospam.nospam> wrote in message news:em5BlnPLGHA.2336@TK2MSFTNGP12.phx.gbl... >I need more information to read about threading in Visual Basic. > > Hopefully something linear w/o too many links to get lost in. I've been > to > http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconThreading.asp > but it is too confusing. I can't find any references to STA threading > model or what exactly this is doing: > > <STAThread()> Public Shared Sub Main(ByVal CmdArgs() As String) > Application.Run(New Form1) > End Sub > > Thanks yes and no, I'm coming from VB4 but have never touched threading
before. Thanks for the links. I'll look at them today. CMM wrote: Show quoteHide quote > To complement Cor's post.... If you're coming from the VB.Classic world and > need to understand threading in relation to VB.Classic's and COM's threading > models, start here: > http://blogs.msdn.com/jfoscoding/archive/2005/04/07/406341.aspx > Then > http://www.devx.com/DevX/10MinuteSolution/20365 > > I can give you a canned response about what Application.Run does, but this > will be more informative: > http://dotnet.sys-con.com/read/39039.htm > I'd found the DevX one yesterday. Unfortunately both are in C. Because
of that I couldn't quite figure out how it related to some sample VB.Net code I have that uses multi-threading. http://dotnet.sys-con.com/read/39039.htm I didn't understand. I'm beginning to wonder if I should dump vb.net and start using C++ or C#. :) It seems most examples are in C something. cj wrote: Show quoteHide quote > yes and no, I'm coming from VB4 but have never touched threading > before. Thanks for the links. I'll look at them today. > > CMM wrote: >> To complement Cor's post.... If you're coming from the VB.Classic >> world and need to understand threading in relation to VB.Classic's and >> COM's threading models, start here: >> http://blogs.msdn.com/jfoscoding/archive/2005/04/07/406341.aspx >> Then >> http://www.devx.com/DevX/10MinuteSolution/20365 >> >> I can give you a canned response about what Application.Run does, but >> this will be more informative: >> http://dotnet.sys-con.com/read/39039.htm >> cj,
I agree with you that it seems that almost everything written about threads is done in a difficult way. The problem with those two Microsoft samples is that they are good, however seems to be made in an hour and than even direct translated from C#. They are in my opinion both more confusing for me than educating. I don't expect because of the new backgroundworker, that there will me much more samples in feature using raw threading. However multithreading is much simpler than you think in fact if there (writing this message I saw the samples are even there) Create a thread Tell at which method it should start Start it. All written here http://msdn2.microsoft.com/en-us/library/system.threading.thread.aspx Than you have to sent normally (if you don't do it in some of the foolish ways I have seen here) the information from the worker thread to the main thread, what goes assynchone and therefore you need an assynchronous method. For that is the Queue class an ultimate solution. http://msdn2.microsoft.com/en-us/library/system.collections.queue.aspx However because that there can be problems when one thread is unloading it (in your case your main thread) and the worker thread is filling it (there happens than two things in the same time), therefore you have to synclock it before you unload or/and load it, which means that all actions are stopped until the thread who has synclocked it gives it free again (end synclock). This means that you should not use this not needed and only for that for what it is needed. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vblr7/html/vastmsynclock.asp About your sentence for samples in C#, the C# developers have the same problem, they tell that all samples are writen for VB.Net. :-) I hope this helps, Cor Show quoteHide quote "cj" <cj@nospam.nospam> schreef in bericht news:ODorzIZLGHA.360@TK2MSFTNGP12.phx.gbl... > I'd found the DevX one yesterday. Unfortunately both are in C. Because > of that I couldn't quite figure out how it related to some sample VB.Net > code I have that uses multi-threading. > > http://dotnet.sys-con.com/read/39039.htm I didn't understand. > > I'm beginning to wonder if I should dump vb.net and start using C++ or C#. > :) It seems most examples are in C something. > > > cj wrote: >> yes and no, I'm coming from VB4 but have never touched threading before. >> Thanks for the links. I'll look at them today. >> >> CMM wrote: >>> To complement Cor's post.... If you're coming from the VB.Classic world >>> and need to understand threading in relation to VB.Classic's and COM's >>> threading models, start here: >>> http://blogs.msdn.com/jfoscoding/archive/2005/04/07/406341.aspx >>> Then >>> http://www.devx.com/DevX/10MinuteSolution/20365 >>> >>> I can give you a canned response about what Application.Run does, but >>> this will be more informative: >>> http://dotnet.sys-con.com/read/39039.htm >>> Correction: I got the DevX one you sent me confused with another one.
The one you sent me is very good. Thanks! cj wrote: Show quoteHide quote > I'd found the DevX one yesterday. Unfortunately both are in C. Because > of that I couldn't quite figure out how it related to some sample VB.Net > code I have that uses multi-threading. > > http://dotnet.sys-con.com/read/39039.htm I didn't understand. > > I'm beginning to wonder if I should dump vb.net and start using C++ or > C#. :) It seems most examples are in C something. > > > cj wrote: >> yes and no, I'm coming from VB4 but have never touched threading >> before. Thanks for the links. I'll look at them today. >> >> CMM wrote: >>> To complement Cor's post.... If you're coming from the VB.Classic >>> world and need to understand threading in relation to VB.Classic's >>> and COM's threading models, start here: >>> http://blogs.msdn.com/jfoscoding/archive/2005/04/07/406341.aspx >>> Then >>> http://www.devx.com/DevX/10MinuteSolution/20365 >>> >>> I can give you a canned response about what Application.Run does, but >>> this will be more informative: >>> http://dotnet.sys-con.com/read/39039.htm >>>
IsNumeric Bug or misunderstanding?
what's the difference Function parameter function sorting inherited BindingList problem with localization Simple but difficult to find solution for loading HTML into object Help referencing a variable in HTML of an aspx page SOAP with Attachments Strange behavior data-bound combobox VB Project security violation on new Workstation |
|||||||||||||||||||||||