This commit is contained in:
Quantum Leaps 2016-04-29 08:52:53 -04:00
parent bdc74240aa
commit b04fe54bd6
20 changed files with 36 additions and 43 deletions

View File

@ -1,7 +1,7 @@
#-----------------------------------------------------------------------------
# Product: QSpyView -- Customization example for DPP application
# Last updated for version 5.5.0
# Last updated on 2015-08-21
# Last updated for version 5.6.4
# Last updated on 2016-04-25
#
# Q u a n t u m L e a P s
# ---------------------------
@ -65,11 +65,13 @@ proc onPause {} {
# specific canvas for DPP ====================================================
image create photo ::img::e -file img/eating.gif
image create photo ::img::h -file img/hungry.gif
image create photo ::img::t -file img/thinking.gif
image create photo ::img::BTN_UP -file img/BTN_UP.gif
image create photo ::img::BTN_DWN -file img/BTN_DWN.gif
set scriptFolder [file dirname [file normalize [info script]]]
image create photo ::img::e -file $scriptFolder/img/eating.gif
image create photo ::img::h -file $scriptFolder/img/hungry.gif
image create photo ::img::t -file $scriptFolder/img/thinking.gif
image create photo ::img::BTN_UP -file $scriptFolder/img/BTN_UP.gif
image create photo ::img::BTN_DWN -file $scriptFolder/img/BTN_DWN.gif
wm geometry .canv =400x260
.canv.c configure -width 400

View File

@ -3,8 +3,8 @@
/// @ingroup qep
/// @cond
///***************************************************************************
/// Last updated for version 5.6.3
/// Last updated on 2016-04-12
/// Last updated for version 5.6.4
/// Last updated on 2016-04-25
///
/// Q u a n t u m L e a P s
/// ---------------------------
@ -43,15 +43,16 @@
//! The current QP version as a decimal constant XYZ, where X is a 1-digit
// major version number, Y is a 1-digit minor version number, and Z is
// a 1-digit release number.
#define QP_VERSION 563
#define QP_VERSION 564
//! The current QP version number string of the form X.Y.Z, where X is
// a 1-digit major version number, Y is a 1-digit minor version number,
// and Z is a 1-digit release number.
#define QP_VERSION_STR "5.6.3"
#define QP_VERSION_STR "5.6.4"
//! Tamperproof current QP release (5.6.4) and date (16-04-25)
#define QP_RELEASE 0xA061143BU
//! Tamperproof current QP release (5.6.3) and date (16-04-12)
#define QP_RELEASE 0xA063100CU
#ifndef Q_SIGNAL_SIZE
//! The size (in bytes) of the signal of an event. Valid values:

View File

@ -2,8 +2,8 @@
/// @brief QF/C++ port to POSIX/P-threads
/// @cond
///***************************************************************************
/// Last updated for version 5.6.2
/// Last updated on 2016-01-22
/// Last updated for version 5.6.4
/// Last updated on 2016-04-25
///
/// Q u a n t u m L e a P s
/// ---------------------------
@ -47,7 +47,6 @@
#include <limits.h> // for PTHREAD_STACK_MIN
#include <sys/mman.h> // for mlockall()
#include <sys/select.h>
namespace QP {
@ -57,8 +56,9 @@ Q_DEFINE_THIS_MODULE("qf_port")
pthread_mutex_t QF_pThreadMutex_ = PTHREAD_MUTEX_INITIALIZER;
// Local-scope objects -------------------------------------------------------
static long int l_tickUsec = 10000UL; // clock tick in usec (for tv_usec)
static bool l_running;
static struct timespec l_tick;
enum { NANOSLEEP_NSEC_PER_SEC = 1000000000 }; // see NOTE05
static void *ao_thread(void *arg); // thread routine for all AOs
@ -75,6 +75,9 @@ void QF::init(void) {
bzero(&QF::timeEvtHead_[0],
static_cast<uint_fast16_t>(sizeof(QF::timeEvtHead_)));
bzero(&active_[0], static_cast<uint_fast16_t>(sizeof(active_)));
l_tick.tv_sec = 0;
l_tick.tv_nsec = NANOSLEEP_NSEC_PER_SEC/100L; // default clock tick
}
//............................................................................
int_t QF::run(void) {
@ -90,13 +93,11 @@ int_t QF::run(void) {
// setting priority failed, probably due to insufficient privieges
}
struct timeval timeout = { 0 }; // timeout for select()
l_running = true;
while (l_running) {
while (l_running) { // the clock tick loop...
QF_onClockTick(); // clock tick callback (must call QF_TICK_X())
timeout.tv_usec = l_tickUsec;
select(0, 0, 0, 0, &timeout); // sleep for the full tick , NOTE05
nanosleep(&l_tick, NULL); // sleep for the number of ticks, NOTE05
}
onCleanup(); // invoke cleanup callback
pthread_mutex_destroy(&QF_pThreadMutex_);
@ -104,7 +105,7 @@ int_t QF::run(void) {
}
//............................................................................
void QF_setTickRate(uint32_t ticksPerSec) {
l_tickUsec = 1000000UL / ticksPerSec;
l_tick.tv_nsec = NANOSLEEP_NSEC_PER_SEC / ticksPerSec;
}
//............................................................................
void QF::stop(void) {
@ -225,22 +226,7 @@ static void *ao_thread(void *arg) { // the expected POSIX signature
// I/O), and the rest highest-priorities for the active objects.
//
// NOTE05:
// The select() system call seems to deliver the finest time granularity of
// 1 clock tick. The timeout value passed to select() is rounded up to the
// nearest tick (10 ms on desktop Linux). The timeout cannot be too short,
// because the system might choose to busy-wait for very short timeouts.
// An alternative, POSIX nanosleep() system call seems to deliver only 20ms
// granularity.
//
// Here the select() call is used not just as a fairly portable way to sleep
// with subsecond precision. The select() call is also used to detect any
// characters typed on the console.
//
// Also according to man pages, on Linux, the function select() modifies
// timeout to reflect the amount of time not slept; most other implementations
// do not do this. This causes problems both when Linux code which reads
// timeout is ported to other operating systems, and when code is ported to
// Linux that reuses a struct timeval for multiple selects in a loop without
// reinitializing it. Here the microsecond part of the structure is re-
// initialized before each select() call.
// In some (older) Linux kernels, the POSIX nanosleep() system call might
// deliver only 2*actual-system-tick granularity. To compensate for this,
// you would need to reduce (by 2) the constant NANOSLEEP_NSEC_PER_SEC.
//

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,2 @@
#TargetFrameworkVersion=v4.0:PlatformToolSet=v120:EnableManagedIncrementalBuild=false:VCToolArchitecture=Native32Bit
QSpy|Win32|C:\qp\qpcpp\ports\win32-qv\|

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,2 @@
#TargetFrameworkVersion=v4.0:PlatformToolSet=v120:EnableManagedIncrementalBuild=false:VCToolArchitecture=Native32Bit
QSpy|Win32|C:\qp\qpcpp\ports\win32\|

Binary file not shown.

View File

@ -4,8 +4,8 @@
/// @cond
///***************************************************************************
/// Product: QK/C++
/// Last updated for version 5.6.3
/// Last updated on 2016-04-12
/// Last updated for version 5.6.4
/// Last updated on 2016-04-25
///
/// Q u a n t u m L e a P s
/// ---------------------------
@ -306,7 +306,7 @@ void QK_sched_(uint_fast8_t p) {
// find new highest-prio AO ready to run...
p = QK_readySet_.findMax();
// is the new priority below the current preemption threshold?
// is the new priority below the initial preemption threshold?
if (p <= pin) {
p = static_cast<uint_fast8_t>(0); // active object not eligible
}