fprime/Svc/LinuxTimer/LinuxTimerTaskDelay.cpp
Timothy Canham 719faac6f2
Move BlockDriver to Ref example (#3651)
* Moved BlockDrv to Ref

* Fixed unit tests

* Updated LinuxTimer component name

* Fixed unit tests

* Re-removed LinuxTimerImpl.hpp

* Fixed a bunch of doc references to Drv/BlockDriver

* Spelling fix

* Added linux to spelling expect

* Doc fixes, have Svc/LinuxTimer use tick interface

* Added to change log

---------

Co-authored-by: Thomas Boyer-Chammard <49786685+thomas-bc@users.noreply.github.com>
2025-06-04 10:38:29 -07:00

36 lines
1.1 KiB
C++

// ======================================================================
// \title LinuxTimerImpl.cpp
// \author tim
// \brief cpp file for LinuxTimer component implementation class
//
// \copyright
// Copyright 2009-2015, by the California Institute of Technology.
// ALL RIGHTS RESERVED. United States Government Sponsorship
// acknowledged.
//
// ======================================================================
#include <Svc/LinuxTimer/LinuxTimer.hpp>
#include <Fw/FPrimeBasicTypes.hpp>
#include <Os/Task.hpp>
namespace Svc {
void LinuxTimer::startTimer(FwSizeType interval) {
FW_ASSERT(std::numeric_limits<U32>::max()/1000 >= interval); // Overflow
while (true) {
Os::Task::delay(Fw::TimeInterval(static_cast<U32>(interval/1000), static_cast<U32>((interval % 1000) * 1000)));
this->m_mutex.lock();
bool quit = this->m_quit;
this->m_mutex.unLock();
if (quit) {
return;
}
this->m_rawTime.now();
this->CycleOut_out(0,this->m_rawTime);
}
}
} // end namespace Svc