zoukankan      html  css  js  c++  java
  • COM是如何实现STA的

    Rather than using thread synchronization objects (mutexes, semaphores, and so forth) to control access to an object by several threads, the marshaling process for STAs translates the call into a WM_USER message and posts the result to a hidden top-level window associated with the apartment when it was created. Calls from several different threads are converted and sent to wait in the apartment's message queue until they are retrieved, dispatched, and executed on the apartment's thread. This process controls access to an apartment's objects by forcing incoming calls to pass through a sort of turnstile, thereby rendering the object's interface implementations thread-safe. An additional benefit of using the message queue is that inter-apartment COM calls are synchronized with window messages, which provides a means for objects that interact with users to synchronize incoming COM calls with the operation of the user interface (UI).

    也就是说基于消息队列,串行化调用请求实现单线程模式。

  • 相关阅读:
    iOS开发UI篇—Modal简单介绍
    iOS开发UI篇—APP主流UI框架结构
    A1081. Rational Sum
    A1049. Counting Ones
    A1008. Elevator
    A1104. Sum of Number Segments
    B1003. 我要通过!
    二分查找、two points、排序
    A1069. The Black Hole of Numbers
    A1101. Quick Sort
  • 原文地址:https://www.cnblogs.com/wusong/p/4181233.html
Copyright © 2011-2022 走看看