vb.net - Can Multiple BackgroundWorkers use the same Function / end Variable? -


is okay if let's have

backgroundwoker1 backgroundwoker2 

both of them having :

addhandler backgroundwoker1.dowork, addressof requestdatatravelpackagesname addhandler backgroundwoker1.progresschanged, addressof showloadinganim 

and in other line (with different time usage)

addhandler backgroundwoker2.dowork, addressof requestdatatravelpackagesname addhandler backgroundwoker2.progresschanged, addressof showloadinganim 

is allowed? because tried similar thing, , appeared form malfunctions. doesn't gives me error / message. frame (gui) vanished.

i'm thinking perhaps because of multiple background workers have. accessing same variable (at completed function) or in similar function / etc.

there's absolutely no issue you're suggesting in principle. if there's issue it's implementation.

the dowork event handler method gets executed on secondary thread. it's common have same method executing on multiple threads @ same time , there's no issue that. progresschanged event handler gets executed on ui thread you're never going have more 1 instance executing @ time anyway.

as in multi-threading scenarios, need ensure synchronise access common data. issues may arise single-threaded code must taken account too, possible cross-threaded access controls avoid.

to know issue in specific case, we'd need know happens in specific case.


Comments

Popular posts from this blog

jQuery Mobile app not scrolling in Firefox -

c++ - How to add Crypto++ library to Qt project -

php array slice every 2th rule -