diff options
| author | hibby <d@vehibberd.com> | 2026-10-06 21:24:40 +0100 |
|---|---|---|
| committer | hibby <d@vehibberd.com> | 2026-10-06 21:24:40 +0100 |
| commit | c25cbdf6fb6d946175f4335fab77bfea601b56db (patch) | |
| tree | 6f7a94b7b81f999e434f61b73d47e337dfd26bf2 /Ft8MtdDecodeScheduler.hpp | |
| parent | 71f5689252c9f13e70e1c24856904475b2307809 (diff) | |
| parent | 0685fcada9f95fe90f70b387cd7d757da8209624 (diff) | |
Merge tag 'debian/3.2.0_rc1+dfsg-2' into debian/trixie-backportsdebian/trixie-backports
tagging wsjtx 3.2.0~rc1+dfsg-2
Diffstat (limited to 'Ft8MtdDecodeScheduler.hpp')
| -rw-r--r-- | Ft8MtdDecodeScheduler.hpp | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/Ft8MtdDecodeScheduler.hpp b/Ft8MtdDecodeScheduler.hpp new file mode 100644 index 00000000..93f080aa --- /dev/null +++ b/Ft8MtdDecodeScheduler.hpp @@ -0,0 +1,66 @@ +#ifndef FT8_MTD_DECODE_SCHEDULER_HPP +#define FT8_MTD_DECODE_SCHEDULER_HPP + +#include <QtGlobal> + +class Ft8MtdDecodeScheduler +{ +public: + static bool supportsBackpressure (bool multithreadedFt8, + bool standardFinalRequired) + { + return multithreadedFt8 && !standardFinalRequired; + } + + enum class Stage + { + None, + EarlyOne, + EarlyTwo, + Final + }; + + enum class Action + { + Publish, + SkipEarly, + DeferFinal, + ReplaceFinal + }; + + struct Decision + { + Action action {Action::Publish}; + bool enteredDegraded {false}; + int skippedPeriods {0}; + }; + + Decision request (Stage stage, qint64 period, int earlyStageCount, + bool decoderBusy, bool finalAlreadyPending); + bool published (Stage stage, qint64 period); + void completed (Stage stage, qint64 period); + void publicationFailed (Stage stage, qint64 period); + void cancel (); + + bool degraded () const {return degraded_;} + int skippedPeriods () const; + qint64 nextProbePeriod () const {return nextProbePeriod_;} + +private: + static constexpr int BackoffCount {4}; + static constexpr int BackoffPeriods[BackoffCount] {1, 2, 4, 8}; + + void degrade (qint64 period, bool advance); + bool probeComplete (qint64 period) const; + void clearProbe (); + + bool degraded_ {false}; + int backoffIndex_ {0}; + qint64 nextProbePeriod_ {0}; + qint64 probePeriod_ {-1}; + int probeEarlyStageCount_ {0}; + int completedEarlyStages_ {0}; + bool recoverOnFinalPublish_ {false}; +}; + +#endif |
