Run X Number Of Manageable Threads?

Mar 23, 2011

How can I make an application to start only "x" number of threads at a time?

View 1 Replies


ADVERTISEMENT

VS 2010 Get A Max Of Number Of Threads Available?

Feb 26, 2012

I've written an app - that use httplisteners to talk to other winforms (they will be services but are now simple form apps so I can easily show stats as they communicate). One UI app talking to three other "service" apps - all talking to each other as well...Everything uses multi-threading...At any rate - how many threads do I have available - I see that most of the apps seem to run "two or three" consecutive threads - but not more than that.Is that just a byproduct of running in the IDE - or is there a max of number of threads available?When more threads are asked for than are available - do they simply wait to get started for a free thread to become available?

View 4 Replies

C# - Can The Number Of Foreground Threads Be Determined In .NET

Mar 8, 2011

I've searched a good deal on the topic and have found little results. It seems adding foreground into the criteria on any engine I've used causes tons of entry level documents on threading in .Net.

In my current project I have a foreground thread within a static class that lies dormant until it is told otherwise. It contains a queue of items that must be processed and the items application cannot close without all items being processed. Right now I have a method that tells the thread that it should stop accepting new items and close when it is finished processing everything, but not everyone on the team remembers to call the method. Having the GUI close while the process still runs in the background is quite a bug in my opinion. If I can add a periodic check to see if the queued thread is the last foreground thread, then I can call the method and not have to worry about others that use the class.

View 2 Replies

How To Create A Dynamic Number Of Threads

Jan 6, 2010

Currently I create a thread the following way (the normal way)

Public loginThread As Thread
Public loginThreadStart As New ThreadStart(AddressOf LogIntoWhatever)
Public callLoggedIn As New MethodInvoker(AddressOf loggedIn)

However, what I want to be able to do is something along the lines of (this obviously does not work, and is entirely pseudocode)

dim i as integer = 0
for i = 0 to i = 25
Public loginThread(i) as Thread
Public loginThreadStart(i) as New ThreadStart(AddressOf LogIntoWhatever)
next i
Public callLoggedIn as new MethodInvoker(AddressOf loggedIn)

Where I could change 25 to whatever I wanted and have that number of threads created. They would all be running an identical sub which does do not make calls of any kind to each other, they don't need knowledge of each other. Is anything like this possible?

View 3 Replies

How To Create X Number Of Threads Without Hardcoding

Sep 24, 2010

[code]How do I create X number of threads without hardcoding?Eg. user decides the number of threads

View 1 Replies

Set Limit To The Number Of Threads For BackgroundWorker?

Mar 17, 2011

Is there any way/property to set BackgroundWorker to execute only x number of threads?

View 1 Replies

What Is The Max Number Of Threads In The Thread Pool

Sep 22, 2009

I've been reading up on multi-threading and just have a couple trivia questions that are ambiguous given my sources:

1) What is the max number of threads in the thread pool? The number 25 is used but I have on reference that says 25 per CPU and another that says 25 per core. I realize that both can be right but before I start making flagrant design decisions I'd like some validation.

2) Let's say I'm in the body of a delegate and I call a function or sub. Does that function/sub remain in the thread or does it revert to the parent thread? I'm guessing the former would be much easier to implement so that's probably what MS did but you just can never tell.

View 10 Replies

1 To N Thread - Show A Definite Number Of Threads?

Sep 3, 2009

Does anyone have a 1 to n thread example in which n threads are created dynamically? There are a number of examples that show a definite number of threads, and some that imply n threads by using a tcp ip listener or a file system listener. However, I'm looking for a 1 to n created in response to a dynamic requirements, provided purely by and for my program.Essentially, my requirement is to be scalable. 1 to n threads based on application throughput should make this pretty easy to satisfy.

View 9 Replies

Start Multiple Threads But Not A Specific Number?

Dec 3, 2009

I want to start multiple threads but not a specific number. For example;

private sub do_sth
...
end sub

[Code]....

View 1 Replies

Multithreading - .NET 4.0 Execute Multiple Threads But Threads Are Completed Before Resuming?

Oct 19, 2011

I just had a new, last-minute idea on to take on a task, so I am running to StackExchange for quick help.

What I want to do is execute a series of methods right in a row, each in their own threads. I want the application to wait until all of these threads are completed, after which the program will resume. It also has to use managed threading (thread pool).

What quick examples could you provide to help me along the way? If it's too complex, what things should I know about so that I can Google it on my own?

View 1 Replies

Queue Threads - Spawn A Series Of 'child' Threads From A Loop

Dec 30, 2009

I have a main thread which is designed to be a batch processor - it spawns a series of 'child' threads from a loop (which can vary in terms of the no of items) - see below

[Code]...

However, each of the 'child' threads could take anywhere from milliseconds to about a minute to process - depending on the complexity of each calculation. There may also be a large number of child threads - e.g 100s. Creating large numbers of child threads is not efficient. I therefore want some way to effectively queue each child thread (and cancel if the process is taking too long to complete). Autoevents seems like one way of doing this, but the only examples I can find seem to assume there are two different processes on seperate threads, not one process being repeated.

View 4 Replies

Forms :: Use A If Statement To See If Fosters Button And Number 1 On The Number Pad Are Both Pressed Then Multiply Constant By Quantity Number?

Mar 4, 2011

I am doing a bar cash register and I want to use a if statement to see if fosters button and number 1 on the number pad are both pressed then multiply constant by quantity number

View 1 Replies

.net - ASP.NET Two Threads, One Result?

Sep 14, 2011

I need to run TWO Threads in a web application, .NET. 3.5 Both methods MakeRedCars and MakeBlueCars need to run at the same time as both take 5 seconds. I have tried many example codes with very bad results. I dont need anymore than 2 threads. The main issue I am having is knowing how to wait till they are finished and also how to store the results from each.Each of the Methods do different things, one is a web request, one is a sql call.

Both methods return a list of(cars) for example do:

carList.addrange(MakeRedCars())
carList.addrange(MakeBlueCars())
for each car in carlist<br>
response.write(car.colour + "<r>")
next

I have implemented the answered below and with empty objects all works well, as soon as you hook in a database call that returns the data/objects studio does a JIT and crashes.

View 5 Replies

.net - How Many Threads Can Run Concurrently

Jan 28, 2011

I can only run "so many" threads concurretnly, a notion which I have seen elsewhere.As a threading novoice, how can I determine the maximum number of threads to use? Or is this a "how long is a piece of string" question? What does it depends on? Hardware config or what?

View 4 Replies

.net - Using GDI+ With Multiple Threads?

Apr 18, 2010

it would be best if I just copy and pasted the code (it's very trivial).

Private Sub Main() Handles MyBase.Shown
timer.Interval = 10
timer.Enabled = True
End Sub

[code]....

An exception, "The object is currently in use elsewhere", is raised during the tick event.

View 1 Replies

.NET Scheduling Threads?

Oct 25, 2010

I am having an issue where I need to implement a type of thread scheduling... I'm looking to implement a list of tasks, each with a set time that they need to execute, and after the time is up they will execute the respective code that goes with that task. I would use a timer based solution, however, I don't think that it would be very efficient. There will be a very large list of tasks, some of which need to be executed within seconds of being placed in the list.

View 1 Replies

Best List For 2 Threads?

Jun 10, 2010

I have 2 thread.One that put some data inside a list?the second that take out these data from the same list.what is the best "list" that allows one thread to put something inside and another one that take stuff out>

View 1 Replies

Get Rid Of Background Threads?

Nov 7, 2010

My application generates some background threads to perform some slow jobs (a cycle of ask for a long process to a server - wait - download the result).

View 5 Replies

How To Know All Threads Are Cancelled

Feb 25, 2009

I'm having a bit of an issue killing threads off and resetting my form. After starting the threads, everything runs fine. When I want to cancel the threads, the threads are all killed off "properly" using the Abortable Thread Pool, but how do I know that all the threads are dead? I've tried using both GetAvailableThreads and GetMinThreads compared against the thread count that should be running if they're all killed off, but I can't seem to get it to work. The only time I can get the GetAvailableThreads to return the "correct" number is if I freeze one thread and kill off the rest.

View 7 Replies

How To Merge 2 Threads

May 28, 2010

I have a GUI that is running for a form, let's call it Class xWindow. It has finished processing data and is simply waiting for the user to press a button, i.e. the main thread has nothing to do. Just before it finished processing, it kicked started something that has a callback function which occurs in a new thread (e.g. a system timer or a Bonjour callback to say that a service has been found on a port). This callback occurs within the xWindow class.

[Code]....

View 10 Replies

Keep Adding New Threads As Old Ones End?

Dec 22, 2010

Suppose I have created 70 "rule-finder" objects, and I want to run each one on data.This is a time-consuming process.The new computers with the I7 chip can run 7 processes in parallel, and so I was thinking of running 7 threads at a time. Asone thread ends, I would add another, until all 70 objects are used. When the last rule-finder has completed, I would resume the main course of the program.

View 5 Replies

Let Two Threads Communicate With Each Other

Jun 1, 2009

how can I let two threads communicate with each other by using VB.net?

View 3 Replies

Progress 'bar' Using Threads

Jan 25, 2010

I currently have a program that runs several "intense" queries. I added a textbox and presented status updates when a query was starting, eding and how many were left. This would suite my need, but the textbox doesn't actually display anything until all the queries are finished. It then displays all the updates at once. I'm assuming updating the textbox in another thread would solve this issue, and that is where I am lost. How can I use a thread that receives a message from the main form running the query and have it display it in the textbox?

View 4 Replies

Ran Into Some Threads Tlaking About XML?

Feb 25, 2009

I'm making a Tabbed Web Browser, and I need favorites to add to this web browser, I was searching this forum for answers on how to do it and I ran into some threads tlaking about XML and how they are easily controlled, yet a little more complex. How do I do this? Where do I start?

View 2 Replies

Threads In These Two Methods Different?

Jan 23, 2011

Take a look at the code below. Here I create a thread, set its name, and start it:

Private Sub fileCreated(sender As Object, e As FileSystemEventArgs)
Dim processFileThread As Thread = New Thread(AddressOf fileCreatedHelper)
processFileThread.Name = e.FullPath
processFileThread.Start()
End Sub

This is the sub that is the thread: Private Sub fileCreatedHelper()

[Code]...

View 2 Replies

Threads In Windows App?

Aug 17, 2011

I have a threading problem when it comes to updating the gui from the thread.

In my main function I have the following:

Private Sub StartThreads(Optional OrgName As String = "")

Dim blnMonitorEntered As Boolean = False

[Code]...

View 6 Replies

.net - Set CurrentPrincipal In Winforms For All Threads?

Jan 4, 2011

In a .NET 3.5 Winforms app, after a user provides a username and password, I set a custom principal in the CurrentPrincipal property like this:My.User.CurrentPrincipal = Service.GetPrincipal(username)This is done in a method that is called using Invoke, because the originating thread is not the UI thread:Invoke(New Action(AddressOf doLogin))But when I click on a button in the Winforms application, the CurrentPrincipal property has been reverted to its default, the current Windows user.Dim lPrincipal = My.User.CurrentPrincipal ' not my custom principalApparently, using Invoke while setting the principal does not solve the problem. Is there another way to set the CurrentPrincipal property for all threads in the application?

View 1 Replies

.net - Threadpool Using Upto 200 Threads?

Jun 26, 2011

i have this code which i run with queued 10,000, even when a max of 50 is set but the threadpool counts goes to high.

Public Sub DoWork(ByVal objItem As Object)
Dim objUrl as String = DirectCast(objItem, string)
Try
If objUrl Is Nothing Then

[code]....

EDIT:i use a this code to check the number of runing threads each second

Sub Timer1Tick(sender As Object, e As EventArgs)
tsslthreads.Text=string.Format ("Threads: {0}", Process.GetCurrentProcess().Threads.Count)
End Sub

View 3 Replies

2 Threads Not Working In Parallel?

Sep 28, 2010

I have 2 threads in my Program. Here is code for both of them

Private Sub btnStart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStart.Click

[Code]...

StartReceiving is working fine but StartWriting is called only once and that msgbox in startWriting is never called, any suggestions on this

View 7 Replies

Add Two Numbers Up Using Threads Or Multithreading?

Jun 16, 2012

My question is to add two numbers up using threads or multithreading. Here is what I have:

Module Module1
Sub ThreadA()
Dim I As Integer[code].....

Is there a way I can use this somehow to add two numbers up?

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved