Difference between syncExec() and asyncExec() of Display class

前端 未结 3 1869
一生所求
一生所求 2020-12-16 15:26

I\'m working on a plugin project in which I\'m using Eclipse background processing.
What\'s the difference between the syncExec() and asyncExec() methods of the Display

3条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-16 16:09

    SWT implements single threaded UI model. In this model, only the UI-thread can invoke UI operations. If you try and access an SWT object from outside the UI-thread, you get the exception "org.eclipse.swt.SWTException: Invalid thread access". So to allow other threads to perform operations on objects belonging to the UI-thread, SWT provides syncExec and asyncExec methods.

    This link may help you with an example

提交回复
热议问题