Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

.NET 

Duplicates with multithreading

My code is still makes duplicates but I really don't know why.
Here is my code:
Spoiler (Click to View)

Here is screenshot of duplicates:
Spoiler (Click to View)

I found that this is working:
Spoiler (Click to View)

But this code is too long and I don't like it. I have many functions in my project and using this way for solving that problem is bad.

Please is anyone here, who can help me with that?
Thank you all in advance for help
Why would it not make duplicates? You've done nothing to remove duplicates?
(Aug 20, 2017 01:22 PM)+Haze Wrote:  Why would it not make duplicates? You've done nothing to remove duplicates?

There are no duplicates in rtbAccounts so there should not be any duplicates
Count the amount of accounts before spawning threads. If that's not the case then idk
(Aug 20, 2017 02:03 PM)WhyWork Wrote:  Count the amount of accounts before spawning threads. If that's not the case then idk

Amount of accounts is correct..
(Aug 20, 2017 01:23 PM)SIM-3327349 Wrote:  There are no duplicates in rtbAccounts so there should not be any duplicates

My guess is that since you're using multiple threads, you do not lock access to the rtbAccounts control, this means that multiple threads can access the rtb at once. So look into thread locking/thread syncronisation I believe it's called.

https://www.dotnetperls.com/synclock-vbnet
So you'd want to synclock rtbAccounts
Try that and let me know how it goes
(Aug 20, 2017 02:24 PM)+Haze Wrote:  My guess is that since you're using multiple threads, you do not lock access to the rtbAccounts control, this means that multiple threads can access the rtb at once. So look into thread locking/thread syncronisation I believe it's called.

https://www.dotnetperls.com/synclock-vbnet
So you'd want to synclock rtbAccounts
Try that and let me know how it goes

It should help, but it didn't.. I tried SyncLock it almost everywhere, but without success.


That's weird. This code is working without problem https://pastebin.com/xUfTpmEv


Possibly Related Threads...
Thread / Author Replies Views Last Post
[C#] by mrjunkyOct 13, 2022 06:15 PM 3 383 Oct 13, 2022 06:15 PM
Last Post: Ekipafond
[Python] by essie98927Apr 25, 2022 02:40 AM 4 175 Apr 25, 2022 02:40 AM
Last Post: essie98927
[C] by LynxJan 3, 2022 04:47 PM 1 184 Jan 3, 2022 04:47 PM
Last Post: yuumi