WPF起步(中) --- 的main thread跟render thread如何通信

接下来的问题是,WPF如何通知这个worker thread什么时候应该Render,这个thread跟main thread是如何通信的。要回答这个问题,我的做法是:

1. 选择一个非常简单的WPF程序,观察该程序idle状态时候每个thread的状态
2. 在Render thread上设定断点,当Render thread触发的时候,再次检查各个thread的状态。

于是我做了一个只有简单button的WPF程序,开始观察:
Idle 状态:

0:000> !clrstack
OS Thread Id: 0x145c (0)
ESP       EIP    
0012f354 7c8285ec [ComPlusMethodFrameGeneric: 0012f354] MS.Win32.UnsafeNativeMethods+ITfMessagePump.GetMessageW(System.Windows.Interop.MSG ByRef, Int32, Int32, Int32, Boolean ByRef)
0012f374 56d61937 System.Windows.Threading.Dispatcher.GetMessage(System.Windows.Interop.MSG ByRef, IntPtr, Int32, Int32)
0012f3c0 56d617e3 System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame)
0012f410 56d616c7 System.Windows.Threading.Dispatcher.PushFrame(System.Windows.Threading.DispatcherFrame)
0012f42c 56d6162d System.Windows.Threading.Dispatcher.Run()
0012f438 5533dce0 System.Windows.Application.RunInternal(System.Windows.Window)
0012f464 5533db15 System.Windows.Application.Run(System.Windows.Window)
0012f474 5533d766 System.Windows.Application.Run()
0012f47c 00f000ad WpfApplication1.App.Main()
0012f69c 79e7c74b [GCFrame: 0012f69c]

   6  Id: 1874.103c S

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值