c# - Why can't I access properties of an UI control from another thread? -
i read it's not possible access ui elements thread (not gui, 2 different threads) , saw code how workaround it, didn't find explanation why can't it?
the reason msdn gives not allowing this:
access windows forms controls not inherently thread safe. if have 2 or more threads manipulating state of control, it possible forcefulness command inconsistent state. other thread-related bugs possible well, including race conditions , deadlocks. of import ensure access controls done in thread-safe way.
so technically possible (and maybe left out by-design), problem underlying code microsoft isn't thread safe. has inner workings of windows , it's lack of thread safety in win32 ui model.
c# multithreading user-interface
No comments:
Post a Comment