Đã hoàn thành

Basic thread polling code in C#

I need someone familiar with threads and thread polling in C# to write some pretty basic piece of code for me.

There's a Form with a multiline TextBox, a Button and a StatusBar. User enters a few lines of text in the TextBox and clicks the Button.

For each line in the TextBox I need a foo(line) method to be called BUT I want this to be done in multiple threads (max number of threads running at once should be hard-coded). Each thread should also increment a global counter variable / property of Form1 class (you need to be familiar with data monitoring/locking so that the value doesn't get wrong) and update the statusbar text with its value when it's finished.

Basically, I need the following pseudocode translated into working C#:

foreach(line in textbox) {

if(number_of_running_threads == max_number_of_threads) {



run_in_thread( foo(line) );


You can leave the foo() body empty or put some random sleep() there or whatever. For an experienced C# dev this shouldn't take longer than an hour.

Kĩ năng: Lập trình C#, Kiến trúc phần mềm

Xem nhiều hơn: polling thread, polling code, thread polling, polling code thread, basic polling, write thread polling, polling threads, write programming code, variable programming, variable in programming, thread programming, t$c, sleep programming, programming variable, programming in basic, programming basic, or in c programming, max programming, hour of code, get in c programming, foo programming, c programming random number, counter programming, code line, code for programming

Về Bên Thuê:
( 2 nhận xét ) Katowice, Poland

ID dự án: #1692317

Được trao cho:


will be done in 1 hour

$30 USD trong 0 ngày
(72 Đánh Giá)