Skip to content

Commit

Permalink
8.0.2
Browse files Browse the repository at this point in the history
corrected ports/posix-qv/qf_port.cpp
  • Loading branch information
quantum-leaps committed Jan 22, 2025
1 parent df116c8 commit 0811544
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 30 deletions.
53 changes: 24 additions & 29 deletions ports/posix-qv/qf_port.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
//============================================================================
// QP/C++ Real-Time Embedded Framework (RTEF)
// Version 8.0.2
//
// Copyright (C) 2005 Quantum Leaps, LLC. All rights reserved.
//
// Q u a n t u m L e a P s
// ------------------------
// Modern Embedded Software
// Q u a n t u m L e a P s
// ------------------------
// Modern Embedded Software
//
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-QL-commercial
//
Expand All @@ -17,11 +18,10 @@
// Plagiarizing this software to sidestep the license obligations is illegal.
//
// NOTE:
// The GPL (see <www.gnu.org/licenses/gpl-3.0>) does NOT permit the
// incorporation of the QP/C software into proprietary programs. Please
// contact Quantum Leaps for commercial licensing options, which expressly
// supersede the GPL and are designed explicitly for licensees interested
// in using QP/C in closed-source proprietary applications.
// The GPL does NOT permit the incorporation of this code into proprietary
// programs. Please contact Quantum Leaps for commercial licensing options,
// which expressly supersede the GPL and are designed explicitly for
// closed-source distribution.
//
// Quantum Leaps contact information:
// <www.state-machine.com/licensing>
Expand Down Expand Up @@ -166,26 +166,22 @@ static int_t l_critSectNest; // critical section nesting up-down counter

//............................................................................
void enterCriticalSection_() {
if (l_isRunning) {
pthread_mutex_lock(&l_critSectMutex_);
Q_ASSERT_INCRIT(101, l_critSectNest == 0); // NO nesting of crit.sect!
++l_critSectNest;
}
pthread_mutex_lock(&l_critSectMutex_);
Q_ASSERT_INCRIT(101, l_critSectNest == 0); // NO nesting of crit.sect!
++l_critSectNest;
}
//............................................................................
void leaveCriticalSection_() {
if (l_isRunning) {
Q_ASSERT_INCRIT(102, l_critSectNest == 1); // crit.sect. must balance!
if ((--l_critSectNest) == 0) {
pthread_mutex_unlock(&l_critSectMutex_);
}
Q_ASSERT_INCRIT(102, l_critSectNest == 1); // crit.sect. must balance!
if ((--l_critSectNest) == 0) {
pthread_mutex_unlock(&l_critSectMutex_);
}
}

//............................................................................
void init() {
// init the global condition variable with the default initializer
pthread_cond_init(&condVar_, NULL);
pthread_cond_init(&condVar_, nullptr);

readySet_.setEmpty();

Expand Down Expand Up @@ -259,8 +255,6 @@ int run() {
QS_END_PRE()

while (l_isRunning) {
Q_ASSERT_INCRIT(300, readySet_.verify_(&readySet_dis_));

// find the maximum priority AO ready to run
if (readySet_.notEmpty()) {
std::uint_fast8_t p = readySet_.findMax();
Expand Down Expand Up @@ -298,8 +292,8 @@ int run() {
}
}
QF_CRIT_EXIT();
onCleanup(); // cleanup callback
QS_EXIT(); // cleanup the QSPY connection
onCleanup(); // cleanup callback
QS_EXIT(); // cleanup the QSPY connection

pthread_cond_destroy(&condVar_); // cleanup the condition variable
pthread_mutex_destroy(&l_critSectMutex_); // cleanup the global mutex
Expand Down Expand Up @@ -365,25 +359,26 @@ int consoleWaitForKey() {

// QActive functions =========================================================
void QActive::start(QPrioSpec const prioSpec,
QEvtPtr * const qSto, std::uint_fast16_t const qLen,
void * const stkSto, std::uint_fast16_t const stkSize,
void const * const par)
QEvtPtr * const qSto, std::uint_fast16_t const qLen,
void * const stkSto, std::uint_fast16_t const stkSize,
void const * const par)
{
Q_UNUSED_PAR(stkSto);
Q_UNUSED_PAR(stkSize);

// no per-AO stack needed for this port
QF_CRIT_STAT
QF_CRIT_ENTRY();
Q_REQUIRE_INCRIT(800, stkSto == nullptr);
Q_REQUIRE_INCRIT(600, stkSto == nullptr);
QF_CRIT_EXIT();

m_eQueue.init(qSto, qLen);

m_prio = static_cast<std::uint8_t>(prioSpec & 0xFFU); // QF-priority
m_prio = static_cast<std::uint8_t>(prioSpec & 0xFFU); // QF-priority of the AO
m_pthre = 0U; // preemption-threshold (not used in this port)
register_(); // register this AO

m_eQueue.init(qSto, qLen);

// top-most initial tran. (virtual call)
this->init(par, m_prio);
QS_FLUSH(); // flush the trace buffer to the host
Expand Down
2 changes: 1 addition & 1 deletion qpcpp_8.0.2.sha1
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ b566671ee550bd9735005b04f474cac6eb3301dd *ports/posix/qs_port.cpp
e6a5523e16619370638f6305687cd480d1e3744b *ports/posix/README.md
7235457eb9529f9fe2459ce869e63294ec5c5df6 *ports/posix/safe_std.h
493900b9aa5475785c65458332995a184690d43f *ports/posix-qv/CMakeLists.txt
0e0243f24a521c6c135c548b22854543a5cdf4b1 *ports/posix-qv/qf_port.cpp
09bd059bc8a077f3aba781e37c748b14b596f36f *ports/posix-qv/qf_port.cpp
2909abe049eff960b4008efaa9c6a12eff5a6517 *ports/posix-qv/qp_port.hpp
b566671ee550bd9735005b04f474cac6eb3301dd *ports/posix-qv/qs_port.cpp
0242b0613d7133442426f5834f2677e77b32014b *ports/posix-qv/qs_port.hpp
Expand Down

0 comments on commit 0811544

Please sign in to comment.