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);
38 EventLoopTimerRef timer_;
50 static void timer_proc(EventLoopTimerRef,
void*
v) {
51 ((OcTimer*)
v)->timerExpired(0, 0);
56 static void CALLBACK callback(PVOID lpParameter,
BOOLEAN TimerOrWaitFired) {
57 ((OcTimer*) lpParameter)->timerExpired(0, 0);
65 OcTimer*
t = (OcTimer*)
v;
69 return double(
t->seconds());
77 OcTimer*
t = (OcTimer*)
v;
86 OcTimer*
t = (OcTimer*)
v;
106 OcTimer*
t = (OcTimer*)
v;
117 OcTimer::OcTimer(
const char* cmd) {
131 OcTimer::OcTimer(
Object* cmd) {
145 OcTimer::~OcTimer() {
154 InstallEventLoopTimer(
155 GetMainEventLoop(), seconds_, seconds_, timer_proc, (
void*)
this, &timer_);
159 LARGE_INTEGER nsec100;
160 nsec100.QuadPart = (
long long) (-seconds_ * 10000000.);
162 while (stopped_ ==
false) {
163 SetWaitableTimer(wtimer_, &nsec100, 0,
NULL,
NULL, 0);
165 WaitForSingleObject(wtimer_, INFINITE);
167 CloseHandle(wtimer_);
170 long s = long(seconds_);
171 long us = long((seconds_ -
double(s)) * 1000000.);
173 Dispatcher::instance().startTimer(s, us,
this);
180 RemoveEventLoopTimer(timer_);
188 Dispatcher::instance().stopTimer(
this);
192 void OcTimer::timerExpired(
long,
long) {
205 double OcTimer::seconds() {
208 void OcTimer::seconds(
double sec) {
double chkarg(int, double low, double high)
int hoc_is_object_arg(int narg)
Object ** hoc_objgetarg(int)
void class2oc(const char *, void *(*cons)(Object *), void(*destruct)(void *), Member_func *, int(*checkpoint)(void **), Member_ret_obj_func *, Member_ret_str_func *)
static void t_destruct(void *v)
static double t_seconds(void *v)
static double t_start(void *v)
static double t_stop(void *v)
static void * t_cons(Object *)