Cygwin: posix timers: move definition of timer_tracker class to new timer.h
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
parent
9ef0cd6a6c
commit
c406bea20b
@ -14,37 +14,9 @@ details. */
|
|||||||
#include "fhandler.h"
|
#include "fhandler.h"
|
||||||
#include "dtable.h"
|
#include "dtable.h"
|
||||||
#include "cygheap.h"
|
#include "cygheap.h"
|
||||||
|
#include "timer.h"
|
||||||
#include <sys/param.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);
|
timer_tracker NO_COPY ttstart (CLOCK_REALTIME, NULL);
|
||||||
|
|
||||||
class lock_timer_tracker
|
class lock_timer_tracker
|
||||||
|
41
winsup/cygwin/timer.h
Normal file
41
winsup/cygwin/timer.h
Normal file
@ -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__ */
|
Loading…
x
Reference in New Issue
Block a user