diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2019-01-11 19:40:03 +0100 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2019-01-12 21:20:19 +0100 |
commit | c406bea20b45f8cf4bdbf18c6abaacfd16f6b4f2 (patch) | |
tree | 7e89e2408cd3ae84942de40de092ecd1e331b73f | |
parent | 9ef0cd6a6c4e748ef40e08c62ad84cf70f37161d (diff) | |
download | cygnal-c406bea20b45f8cf4bdbf18c6abaacfd16f6b4f2.tar.gz cygnal-c406bea20b45f8cf4bdbf18c6abaacfd16f6b4f2.tar.bz2 cygnal-c406bea20b45f8cf4bdbf18c6abaacfd16f6b4f2.zip |
Cygwin: posix timers: move definition of timer_tracker class to new timer.h
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
-rw-r--r-- | winsup/cygwin/timer.cc | 30 | ||||
-rw-r--r-- | winsup/cygwin/timer.h | 41 |
2 files changed, 42 insertions, 29 deletions
diff --git a/winsup/cygwin/timer.cc b/winsup/cygwin/timer.cc index 39a0f9d07..e92cbad2a 100644 --- a/winsup/cygwin/timer.cc +++ b/winsup/cygwin/timer.cc @@ -14,37 +14,9 @@ details. */ #include "fhandler.h" #include "dtable.h" #include "cygheap.h" +#include "timer.h" #include <sys/param.h> -#define TT_MAGIC 0x513e4a1c -class timer_tracker -{ - unsigned magic; - timer_tracker *next; - - clockid_t clock_id; - sigevent evp; - timespec it_interval; - HANDLE hcancel; - HANDLE syncthread; - long long interval_us; - long long sleepto_us; - - bool cancel (); - - public: - timer_tracker (clockid_t, const sigevent *); - ~timer_tracker (); - inline bool is_timer_tracker () { return magic == TT_MAGIC; } - - void gettime (itimerspec *); - int settime (int, const itimerspec *, itimerspec *); - int clean_and_unhook (); - - DWORD thread_func (); - void fixup_after_fork (); -}; - timer_tracker NO_COPY ttstart (CLOCK_REALTIME, NULL); class lock_timer_tracker diff --git a/winsup/cygwin/timer.h b/winsup/cygwin/timer.h new file mode 100644 index 000000000..9a35eb316 --- /dev/null +++ b/winsup/cygwin/timer.h @@ -0,0 +1,41 @@ +/* timer.h: Define class timer_tracker, base class for timer handling + +This file is part of Cygwin. + +This software is a copyrighted work licensed under the terms of the +Cygwin license. Please consult the file "CYGWIN_LICENSE" for +details. */ + +#ifndef __TIMER_H__ +#define __TIMER_H__ + +#define TT_MAGIC 0x513e4a1c +class timer_tracker +{ + unsigned magic; + timer_tracker *next; + + clockid_t clock_id; + sigevent evp; + timespec it_interval; + HANDLE hcancel; + HANDLE syncthread; + long long interval_us; + long long sleepto_us; + + bool cancel (); + + public: + timer_tracker (clockid_t, const sigevent *); + ~timer_tracker (); + inline bool is_timer_tracker () { return magic == TT_MAGIC; } + + void gettime (itimerspec *); + int settime (int, const itimerspec *, itimerspec *); + int clean_and_unhook (); + + DWORD thread_func (); + void fixup_after_fork (); +}; + +#endif /* __TIMER_H__ */ |