Invoke delegate on main thread in console application

前端 未结 3 1421
我在风中等你
我在风中等你 2020-12-18 07:59

In a Windows Application, when multiple threads are used, I know that it’s necessary to invoke the main thread to update GUI components. How is this done in a Console Applic

3条回答
  •  死守一世寂寞
    2020-12-18 08:36

    I was thinking backgroundworker, but since you don't have a UI thread that's out of the question (see this question)

    The 'classic' threading method of using semaphores should probably work. Use a thread safe queue or collection to store events in and notify the main thread that there is work to be donethrough a synchronization object.

提交回复
热议问题