"is it safe to allow two threads to edit different properties of the same object at the same time?" Code Answer

2

to be specific to your question: no there is no problem.

what you should watch out for is that your properties written by the background thread are not read from the ui thread while they are being written. if you can't guarantee this, you must either use locks, marshall the write to the ui thread. (using control.invoke() or backgroundworker or, make sure the write is an atomic write of pointer to an object that is not edited by the background thread while visible from the ui thread. i would not assume standard containers like list<t> are thread safe.

[wording changed]

By CodingNow on August 17 2022

Answers related to “is it safe to allow two threads to edit different properties of the same object at the same time?”

Only authorized users can answer the Search term. Please sign in first, or register a free account.