From: Charles McGarvey Date: Mon, 30 Nov 2009 01:33:03 +0000 (-0700) Subject: sleep forever bug fixed X-Git-Url: https://git.brokenzipper.com/gitweb?a=commitdiff_plain;h=cfe38a72ab859538db6269bc9b97f55e8f1f8709;p=chaz%2Fyoink sleep forever bug fixed --- diff --git a/src/MainLayer.cc b/src/MainLayer.cc index 3429f52..6a426fb 100644 --- a/src/MainLayer.cc +++ b/src/MainLayer.cc @@ -129,13 +129,8 @@ bool MainLayer::handleEvent(const Mf::Event& event) void MainLayer::quit() { -#if NDEBUG - // we don't really need to unwind the stack and shut everything down because - // the operating system will take care of cleaning up - exit(0); -#else + // remove all the layers mEngine->clear(); -#endif } diff --git a/src/Moof/Log.hh b/src/Moof/Log.hh index 1f9d0c6..221827f 100644 --- a/src/Moof/Log.hh +++ b/src/Moof/Log.hh @@ -44,11 +44,13 @@ * @param X test to perform */ -#if ! NDEBUG +#undef ASSERT + +#if NDEBUG +#define ASSERT(X) +#else #define ASSERT(X) if (!(X)) Mf::logError("false assertion at %s:%d, " #X, \ __FILE__, __LINE__), exit(1) -#else -#define ASSERT(X) #endif diff --git a/src/Moof/Timer.cc b/src/Moof/Timer.cc index 733f54c..a4dcf40 100644 --- a/src/Moof/Timer.cc +++ b/src/Moof/Timer.cc @@ -30,6 +30,8 @@ #include #include +#include + #include "Log.hh" #include "Timer.hh" @@ -37,8 +39,6 @@ #include "config.h" #endif -#include - namespace Mf { @@ -194,7 +194,8 @@ Scalar Timer::getTicks() { struct timespec ts; - ASSERT(clock_gettime(CLOCK_MONOTONIC, &ts) == 0 && "cannot access clock"); + int result = clock_gettime(CLOCK_MONOTONIC, &ts); + ASSERT(result == 0 && "cannot access clock"); return Scalar(ts.tv_sec - reference) + Scalar(ts.tv_nsec) / 1000000000.0; }