|
QP/C++
|
00001 00002 // Product: QF/C++ 00003 // Last Updated for Version: 4.4.00 00004 // Date of the Last Update: Mar 28, 2012 00005 // 00006 // Q u a n t u m L e a P s 00007 // --------------------------- 00008 // innovating embedded systems 00009 // 00010 // Copyright (C) 2002-2012 Quantum Leaps, LLC. All rights reserved. 00011 // 00012 // This program is open source software: you can redistribute it and/or 00013 // modify it under the terms of the GNU General Public License as published 00014 // by the Free Software Foundation, either version 2 of the License, or 00015 // (at your option) any later version. 00016 // 00017 // Alternatively, this program may be distributed and modified under the 00018 // terms of Quantum Leaps commercial licenses, which expressly supersede 00019 // the GNU General Public License and are specifically designed for 00020 // licensees interested in retaining the proprietary status of their code. 00021 // 00022 // This program is distributed in the hope that it will be useful, 00023 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00024 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00025 // GNU General Public License for more details. 00026 // 00027 // You should have received a copy of the GNU General Public License 00028 // along with this program. If not, see <http://www.gnu.org/licenses/>. 00029 // 00030 // Contact information: 00031 // Quantum Leaps Web sites: http://www.quantum-leaps.com 00032 // http://www.state-machine.com 00033 // e-mail: info@quantum-leaps.com 00035 #include "qf_pkg.h" 00036 00040 00041 QP_BEGIN_ 00042 00043 //............................................................................ 00044 // NOTE: disarm a time evt (no harm in disarming an already disarmed time evt) 00045 bool QTimeEvt::disarm(void) { 00046 QF_CRIT_STAT_ 00047 QF_CRIT_ENTRY_(); 00048 bool wasArmed; 00049 if (m_prev != null_tevt) { // is the time event actually armed? 00050 wasArmed = true; 00051 if (this == QF_timeEvtListHead_) { 00052 QF_timeEvtListHead_ = m_next; 00053 } 00054 else { 00055 if (m_next != null_tevt) { // not the last in the list? 00056 m_next->m_prev = m_prev; 00057 } 00058 m_prev->m_next = m_next; 00059 } 00060 m_prev = null_tevt; // mark the time event as disarmed 00061 00062 QS_BEGIN_NOCRIT_(QS_QF_TIMEEVT_DISARM, QS::teObj_, this) 00063 QS_TIME_(); // timestamp 00064 QS_OBJ_(this); // this time event object 00065 QS_OBJ_(m_act); // the active object 00066 QS_TEC_(m_ctr); // the number of ticks 00067 QS_TEC_(m_interval); // the interval 00068 QS_END_NOCRIT_() 00069 } 00070 else { // the time event was not armed 00071 wasArmed = false; 00072 00073 QS_BEGIN_NOCRIT_(QS_QF_TIMEEVT_DISARM_ATTEMPT, QS::teObj_, this) 00074 QS_TIME_(); // timestamp 00075 QS_OBJ_(this); // this time event object 00076 QS_OBJ_(m_act); // the active object 00077 QS_END_NOCRIT_() 00078 } 00079 QF_CRIT_EXIT_(); 00080 return wasArmed; 00081 } 00082 00083 QP_END_ 00084
1.7.6.1