Giter Site home page Giter Site logo

qtmainloopwdt's Introduction

Main loop watch dog timer for Qt & QML

When the main loop freezes, this component can kill or restart the current application, just by adding two lines of code.

You can also use the application restart function, for a complete restart of your application.

See in action (video)

Demo in Windows 10

HOW IT WORKS:

  • A timer activated by the main loop triggers watch function every 250 ms.
  • Another timer, triggered by a QThread, checks the status of whatchdog status every 250ms.
  • This function should not affect the performance of the application.
  • In case the app is suspended, the watchdog timer function restarts.
  • When the watchdog timer is activated, the application aborts its execution or restarts (configurable)

USAGE:

create object in main function, just before main loop exec:

mainLoopWdt wdt(true,2000, 5000,0, &app);
wdt.startWdt();
return app.exec();

Tested OS:

  • Ubuntu 20.04
  • MacOS Big Sur
  • Windows 10

Tested main loop locks:

  • QML js infinite loop
  • C++ infinite loop
  • C++ mutex double lock

Restart estrategy

  • Windows : QProcess::startDetached + std::exit (application arguments are kept)
  • Linux & macOs : exec (application arguments are kept)

Delayed restart estrategy

  • Windows : cmd.exe
  • Linux & MacOs : bash

License

Main loop WDT for Qt & QML is released under the terms of the GNU LGPL v3 License. Full details in license.txt file.

qtmainloopwdt's People

Contributors

mapons avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.