using namespace structures;
using namespace timely;
-//#define DEBUG_TIMER_DRIVER
+#define DEBUG_TIMER_DRIVER
// uncomment for noisy code.
#undef LOG
-#define LOG(tpr) printf( (time_stamp::notarize() + "timer_driver::" + func + tpr).s() )
+#define LOG(tpr) printf("%s", (time_stamp::notarize() + "timer_driver::" + func + tpr).s() )
namespace timely {
if (true) { // unknown OS.
#endif
#ifdef DEBUG_TIMER_DRIVER
- LOG(a_sprintf("unknown signal/message %x caught.", (void *)seen));
+ LOG(a_sprintf("unknown signal/message %d caught.", seen));
#endif
return;
}
#if defined(__UNIX__) || defined(__GNU_WINDOWS__)
_prompter(new signalling_thread(INITIAL_TIMER_GRANULARITY)),
#else
- _real_timer_id(NIL),
+ _real_timer_id(NULL_POINTER),
#endif
_in_timer(false)
{
#ifdef __UNIX__
// register for the our personal signal.
signal(OUR_SIGNAL, &timer_driver_private_handler);
- _prompter->start(NIL);
+ _prompter->start(NULL_POINTER);
#endif
}
struct sigaction action;
action.sa_handler = SIG_DFL;
- action.sa_sigaction = NIL;
+ action.sa_sigaction = NULL_POINTER;
sigemptyset(&action.sa_mask);
action.sa_flags = 0;
#ifndef __APPLE__
- action.sa_restorer = NIL;
+ action.sa_restorer = NULL_POINTER;
#endif
- int ret = sigaction(OUR_SIGNAL, &action, NIL);
+ int ret = sigaction(OUR_SIGNAL, &action, NULL_POINTER);
if (ret) {
///uhhh
}
#elif defined(_MSC_VER)
int max_tries_left = 100;
while (max_tries_left-- >= 0) {
- _real_timer_id = (basis::un_int *)SetTimer(NIL, 0, duration,
+ _real_timer_id = (basis::un_int *)SetTimer(NULL_POINTER, 0, duration,
timer_driver_private_handler);
if (!_real_timer_id) {
// failure to set the timer.
// postpone the thread for quite a while so we can take care of business.
_prompter->reschedule(LONG_TIME);
#elif defined(_MSC_VER)
- if (_real_timer_id) KillTimer(NIL, (UINT_PTR)_real_timer_id);
+ if (_real_timer_id) KillTimer(NULL_POINTER, (UINT_PTR)_real_timer_id);
#endif
#ifdef DEBUG_TIMER_DRIVER
LOG("unhooked OS timer.");