D
Dmitri Sologoubenko
Hi, guys!
I need a C++ class (Linux/POSIX/GNU C++), which can be started and stopped,
and calls a virtual callback instance method (e.g. "expired()") when a
given time has elapsed. High resolution means that expire time should be
measured in microseconds, or at least in milliseconds.
I had a look on Gnu C <sys/time.h>'s functions getitimer and setitimer, but
these all use a signal (SIGALRM) to notify expiration, and I don't know the
way to handle this signal from an instance class method.
So, the questions are the following:
1) Is there a way to safely encapsulate a C signal handler in a not-static
C++ class method?
2) Is there any class library that implements this feature?
3) Is there any, other than signal handling, to implement such a timer?
Thanks in advance for your help,
Dmitri S.
I need a C++ class (Linux/POSIX/GNU C++), which can be started and stopped,
and calls a virtual callback instance method (e.g. "expired()") when a
given time has elapsed. High resolution means that expire time should be
measured in microseconds, or at least in milliseconds.
I had a look on Gnu C <sys/time.h>'s functions getitimer and setitimer, but
these all use a signal (SIGALRM) to notify expiration, and I don't know the
way to handle this signal from an instance class method.
So, the questions are the following:
1) Is there a way to safely encapsulate a C signal handler in a not-static
C++ class method?
2) Is there any class library that implements this feature?
3) Is there any, other than signal handling, to implement such a timer?
Thanks in advance for your help,
Dmitri S.