// BotInterp.H -*- C++ -*-
// Copyright (c) 1998 Etienne BERNARD
-// Copyright (C) 2002,2005 Clinton Ebadi
+// Copyright (C) 2002,2005,2008 Clinton Ebadi
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
#ifdef USESCRIPTS
#include <ctime>
+#include <map>
+#include <list>
+#include <functional>
+
#include <libguile.h>
+
+#include "BotThreading.H"
#include "String.H"
+#include "Utils.H"
class Bot;
Timer(int c, std::time_t t, SCM f)
: count(c), when(t), function(f) { }
+
+ bool operator< (const Timer & other) const
+ { return when < other.when; }
};
class BotInterp {
+ typedef std::list<Timer *> TimerList;
+
Bot * bot;
SCM logPort;
std::map<int, std::list<Hook *>, std::less<int> > hooksMap;
- std::list<Timer *> timersList;
+ TimerList timers;
+ Utils::IndirectPred<Timer, std::less<Timer> > timer_sort_p;
int counter;
+ BotMutex hook_mutex;
+ BotMutex timer_mutex; // NOTE: recursive lock
public:
BotInterp(Bot *, String);