1 #include <../../nrnconf.h> 4 #include <Dispatch/iohandler.h> 5 #include <Dispatch/dispatcher.h> 18 #if carbon || defined(MINGW) 21 class OcTimer :
public IOHandler {
28 virtual void timerExpired(
long,
long);
37 EventLoopTimerRef timer_;
49 static void timer_proc(EventLoopTimerRef,
void*
v) {
50 ((OcTimer*)v)->timerExpired(0,0);
55 static void CALLBACK callback(PVOID lpParameter,
BOOLEAN TimerOrWaitFired) {
56 ((OcTimer*)lpParameter)->timerExpired(0,0);
64 OcTimer*
t = (OcTimer*)v;
66 t->seconds(
chkarg(1, 1
e-6, 1e6));
68 return double(t->seconds());
76 OcTimer*
t = (OcTimer*)v;
85 OcTimer*
t = (OcTimer*)v;
105 OcTimer*
t = (OcTimer*)v;
121 OcTimer::OcTimer(
const char* cmd) {
135 OcTimer::OcTimer(
Object* cmd) {
149 OcTimer::~OcTimer() {
155 if (timer_) {
return; }
156 InstallEventLoopTimer(GetMainEventLoop(), seconds_, seconds_, timer_proc,
157 (
void*)
this, &timer_);
161 LARGE_INTEGER nsec100;
162 nsec100.QuadPart = (
long long)(-seconds_*10000000.);
164 while (stopped_ ==
false) {
165 SetWaitableTimer(wtimer_, &nsec100, 0,
NULL,
NULL, 0);
167 WaitForSingleObject(wtimer_, INFINITE);
169 CloseHandle(wtimer_);
172 long s =
long(seconds_);
173 long us =
long((seconds_ -
double(s))*1000000.);
175 Dispatcher::instance().startTimer(s, us,
this);
182 RemoveEventLoopTimer(timer_);
190 Dispatcher::instance().stopTimer(
this);
194 void OcTimer::timerExpired(
long,
long) {
207 double OcTimer::seconds() {
210 void OcTimer::seconds(
double sec) {
static void * t_cons(Object *)
static double t_stop(void *v)
static void t_destruct(void *v)
static double t_seconds(void *v)
void class2oc(const char *, void *(*cons)(Object *), void(*destruct)(void *), Member_func *, int(*checkpoint)(void **), Member_ret_obj_func *, Member_ret_str_func *)
static double t_start(void *v)
int hoc_is_object_arg(int narg)
Object ** hoc_objgetarg(int)
double chkarg(int, double low, double high)