1 #include <../../nrnconf.h>
4 #include <Dispatch/iohandler.h>
5 #include <Dispatch/dispatcher.h>
21 class OcTimer:
public IOHandler {
28 virtual void timerExpired(
long,
long);
44 static void CALLBACK callback(PVOID lpParameter,
BOOLEAN TimerOrWaitFired) {
45 ((OcTimer*) lpParameter)->timerExpired(0, 0);
53 OcTimer*
t = (OcTimer*)
v;
55 t->seconds(
chkarg(1, 1e-6, 1e6));
57 return double(
t->seconds());
65 OcTimer*
t = (OcTimer*)
v;
74 OcTimer*
t = (OcTimer*)
v;
94 OcTimer*
t = (OcTimer*)
v;
108 OcTimer::OcTimer(
const char* cmd) {
116 OcTimer::OcTimer(
Object* cmd) {
124 OcTimer::~OcTimer() {
128 void OcTimer::start() {
131 LARGE_INTEGER nsec100;
132 nsec100.QuadPart = (
long long) (-seconds_ * 10000000.);
134 while (stopped_ ==
false) {
135 SetWaitableTimer(wtimer_, &nsec100, 0,
NULL,
NULL, 0);
137 WaitForSingleObject(wtimer_, INFINITE);
139 CloseHandle(wtimer_);
142 long s = long(seconds_);
143 long us = long((seconds_ -
double(
s)) * 1000000.);
145 Dispatcher::instance().startTimer(
s, us,
this);
148 void OcTimer::stop() {
151 Dispatcher::instance().stopTimer(
this);
154 void OcTimer::timerExpired(
long,
long) {
163 double OcTimer::seconds() {
166 void OcTimer::seconds(
double sec) {
void class2oc(const char *, ctor_f *cons, dtor_f *destruct, Member_func *, Member_ret_obj_func *, Member_ret_str_func *)
double chkarg(int, double low, double high)
int hoc_is_object_arg(int narg)
Object ** hoc_objgetarg(int)
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 *)