• QTimer


    QTimer Class Reference

    In multithreaded applications, you can use QTimer in any thread that has an event loop. To start an event loop from a non-GUI thread, use QThread::exec(). Qt uses the timer's thread affinity to determine which thread will emit the timeout() signal. Because of this, you must start and stop the timer in its thread; it is not possible to start a timer from another thread.

    摘自qt文档,qtimer要在living thread 开启和停止,由于qt利用 thread affinity判断哪个线程发送timeout signal

    Accuracy and Timer Resolution

    Timers will never time out earlier than the specified timeout value and they are not guaranteed to time out at the exact value specified. In many situations, they may time out late by a period of time that depends on the accuracy of the system timers.

    The accuracy of timers depends on the underlying operating system and hardware. Most platforms support a resolution of 1 millisecond, though the accuracy of the timer will not equal this resolution in many real-world situations.

    If Qt is unable to deliver the requested number of timer clicks, it will silently discard some.

    timer只会延迟,不会早。

    qt如果不能发送timer clicks,会丢弃一些。

  • 相关阅读:
    并发编程3
    并发编程2
    4/23
    4/22
    并发编程1
    粘包问题
    Navicat12激活
    IDEA创建maven项目报错解决:Failed to create a Maven project: 'C:/Users/../IdeaProjects/../pom.xml' already e
    IDEA
    windows下查看端口运行情况--解决端口冲突问题
  • 原文地址:https://www.cnblogs.com/cute/p/2563585.html
Copyright © 2020-2023  润新知