Forum » Programiranje » [VB] backgroundworker
[VB] backgroundworker
korenje3 ::
Mene pa zanima, kako narediti backgroundworker da bo unikaten in uporaben za multithreading. recimo da za vsako novo povezavo narediš nov backgroundworker na tak način, da ti pri ustvarjanju novega ne napiše da je busy.
jaz sem naredil recimo takole...
MTconnectp(user(d_mtserver.ColumnName)(1))
IF ukaz kjer preverim če je worker busy.
user(d_mtserver.ColumnName)(1).RunWorkerAsync({user(d_mtserver.ColumnName)(0), user(c_server.DataPropertyName), user(c_port.DataPropertyName), user(c_hash.DataPropertyName), user(d_mtserver.ColumnName)(1)})
zadeva je v loopu in mi pri if ukazu pravi da je worker busy. v čem je fora?
pa tisti parametri ki jih podam v arrayju bg workerju so različni.
jaz sem naredil recimo takole...
Sub MTconnectp(ByRef processval As BackgroundWorker) processval = New BackgroundWorker With {.WorkerReportsProgress = False, .WorkerSupportsCancellation = True} AddHandler processval.DoWork, AddressOf MTconnect_DoWork AddHandler processval.RunWorkerCompleted, AddressOf MTconnect_done End Sub
MTconnectp(user(d_mtserver.ColumnName)(1))
IF ukaz kjer preverim če je worker busy.
user(d_mtserver.ColumnName)(1).RunWorkerAsync({user(d_mtserver.ColumnName)(0), user(c_server.DataPropertyName), user(c_port.DataPropertyName), user(c_hash.DataPropertyName), user(d_mtserver.ColumnName)(1)})
zadeva je v loopu in mi pri if ukazu pravi da je worker busy. v čem je fora?
pa tisti parametri ki jih podam v arrayju bg workerju so različni.
i9-12900k; 32GB DDR5-6000 CL36; Nvidia RTX 3080 ti;
Gigabyte Aorus z690 master; Be Quiet Dark Power 12 1000W
Gigabyte Aorus z690 master; Be Quiet Dark Power 12 1000W
- spremenil: korenje3 ()
korenje3 ::
k mi je že uspelo.
sem naredil nov structure katerega sem podajal v backgroundworker in naprej.
sem naredil nov structure katerega sem podajal v backgroundworker in naprej.
i9-12900k; 32GB DDR5-6000 CL36; Nvidia RTX 3080 ti;
Gigabyte Aorus z690 master; Be Quiet Dark Power 12 1000W
Gigabyte Aorus z690 master; Be Quiet Dark Power 12 1000W
Vredno ogleda ...
Tema | Ogledi | Zadnje sporočilo | |
---|---|---|---|
Tema | Ogledi | Zadnje sporočilo | |
» | [VB.NET] classOddelek: Programiranje | 727 (634) | korenje3 |
» | [VB] datagridviewOddelek: Programiranje | 1940 (1323) | korenje3 |
» | Vprasanje glede koncepta programa [c#]Oddelek: Programiranje | 2058 (1800) | _Dormage_ |
» | [c#] Vprasanje glede BackGroundWorker classa in spreminanja gui elementaOddelek: Programiranje | 784 (710) | Ericssony |
» | C# BackgroundWorker Class problemOddelek: Programiranje | 1260 (1216) | hendriks |