ReactOS 0.4.15-dev-8076-g06e89b2
timerqueue.c File Reference
#include <rtl.h>
#include <debug.h>
#include <wine/list.h>
Include dependency graph for timerqueue.c:

Go to the source code of this file.

Classes

struct  queue_timer
 
struct  timer_queue
 

Macros

#define NDEBUG
 
#define EXPIRE_NEVER   (~(ULONGLONG) 0)
 
#define TIMER_QUEUE_MAGIC   0x516d6954 /* TimQ */
 

Functions

NTSTATUS RtlpInitializeTimerThread (VOID)
 
static PLARGE_INTEGER get_nt_timeout (PLARGE_INTEGER pTime, ULONG timeout)
 
static void queue_remove_timer (struct queue_timer *t)
 
static void timer_cleanup_callback (struct queue_timer *t)
 
static VOID WINAPI timer_callback_wrapper (LPVOID p)
 
static ULONGLONG queue_current_time (void)
 
static void queue_add_timer (struct queue_timer *t, ULONGLONG time, BOOL set_event)
 
static void queue_move_timer (struct queue_timer *t, ULONGLONG time, BOOL set_event)
 
static void queue_timer_expire (struct timer_queue *q)
 
static ULONG queue_get_timeout (struct timer_queue *q)
 
static DWORD WINAPI timer_queue_thread_proc (LPVOID p)
 
static void queue_destroy_timer (struct queue_timer *t)
 
NTSTATUS WINAPI RtlCreateTimerQueue (PHANDLE NewTimerQueue)
 
NTSTATUS WINAPI RtlDeleteTimerQueueEx (HANDLE TimerQueue, HANDLE CompletionEvent)
 
static struct timer_queueget_timer_queue (HANDLE TimerQueue)
 
NTSTATUS WINAPI RtlCreateTimer (HANDLE TimerQueue, PHANDLE NewTimer, WAITORTIMERCALLBACKFUNC Callback, PVOID Parameter, DWORD DueTime, DWORD Period, ULONG Flags)
 
NTSTATUS WINAPI RtlSetTimer (HANDLE TimerQueue, PHANDLE NewTimer, WAITORTIMERCALLBACKFUNC Callback, PVOID Parameter, DWORD DueTime, DWORD Period, ULONG Flags)
 
NTSTATUS WINAPI RtlUpdateTimer (HANDLE TimerQueue, HANDLE Timer, DWORD DueTime, DWORD Period)
 
NTSTATUS WINAPI RtlDeleteTimer (HANDLE TimerQueue, HANDLE Timer, HANDLE CompletionEvent)
 
NTSTATUS NTAPI RtlCancelTimer (HANDLE TimerQueue, HANDLE Timer)
 
NTSTATUS NTAPI RtlDeleteTimerQueue (HANDLE TimerQueue)
 

Variables

PRTL_START_POOL_THREAD RtlpStartThreadFunc
 
PRTL_EXIT_POOL_THREAD RtlpExitThreadFunc
 
HANDLE TimerThreadHandle = NULL
 

Macro Definition Documentation

◆ EXPIRE_NEVER

#define EXPIRE_NEVER   (~(ULONGLONG) 0)

Definition at line 64 of file timerqueue.c.

◆ NDEBUG

#define NDEBUG

Definition at line 13 of file timerqueue.c.

◆ TIMER_QUEUE_MAGIC

#define TIMER_QUEUE_MAGIC   0x516d6954 /* TimQ */

Definition at line 65 of file timerqueue.c.

Function Documentation

◆ get_nt_timeout()

static PLARGE_INTEGER get_nt_timeout ( PLARGE_INTEGER  pTime,
ULONG  timeout 
)
inlinestatic

Definition at line 32 of file timerqueue.c.

33{
34 if (timeout == INFINITE) return NULL;
35 pTime->QuadPart = (ULONGLONG)timeout * -10000;
36 return pTime;
37}
#define NULL
Definition: types.h:112
#define INFINITE
Definition: serial.h:102
Definition: dhcpd.h:245
uint64_t ULONGLONG
Definition: typedefs.h:67
_In_ PCCERT_CONTEXT _In_opt_ LPFILETIME pTime
Definition: wincrypt.h:4837

Referenced by timer_queue_thread_proc().

◆ get_timer_queue()

static struct timer_queue * get_timer_queue ( HANDLE  TimerQueue)
static

Definition at line 375 of file timerqueue.c.

376{
377 static struct timer_queue *default_timer_queue;
378
379 if (TimerQueue)
380 return TimerQueue;
381 else
382 {
383 if (!default_timer_queue)
384 {
385 HANDLE q;
387 if (status == STATUS_SUCCESS)
388 {
390 (void **) &default_timer_queue, q, NULL);
391 if (p)
392 /* Got beat to the punch. */
394 }
395 }
396 return default_timer_queue;
397 }
398}
LONG NTSTATUS
Definition: precomp.h:26
GLdouble GLdouble GLdouble GLdouble q
Definition: gl.h:2063
GLfloat GLfloat p
Definition: glext.h:8902
#define InterlockedCompareExchangePointer
Definition: interlocked.h:129
NTSYSAPI NTSTATUS NTAPI RtlCreateTimerQueue(PHANDLE TimerQueue)
Definition: timerqueue.c:285
NTSYSAPI NTSTATUS NTAPI RtlDeleteTimerQueueEx(_In_ HANDLE TimerQueue, _In_opt_ HANDLE CompletionEvent)
#define STATUS_SUCCESS
Definition: shellext.h:65
Definition: ps.c:97

Referenced by RtlCreateTimer().

◆ queue_add_timer()

static void queue_add_timer ( struct queue_timer t,
ULONGLONG  time,
BOOL  set_event 
)
static

Definition at line 114 of file timerqueue.c.

116{
117 /* We MUST hold the queue cs while calling this function. */
118 struct timer_queue *q = t->q;
119 struct list *ptr = &q->timers;
120
121 assert(!q->quit || (t->destroy && time == EXPIRE_NEVER));
122
123 if (time != EXPIRE_NEVER)
124 LIST_FOR_EACH(ptr, &q->timers)
125 {
126 struct queue_timer *cur = LIST_ENTRY(ptr, struct queue_timer, entry);
127 if (time < cur->expire)
128 break;
129 }
130 list_add_before(ptr, &t->entry);
131
132 t->expire = time;
133
134 /* If we insert at the head of the list, we need to expire sooner
135 than expected. */
136 if (set_event && &t->entry == list_head(&q->timers))
137 NtSetEvent(q->event, NULL);
138}
Definition: list.h:37
#define assert(x)
Definition: debug.h:53
FxCollectionEntry * cur
GLdouble GLdouble t
Definition: gl.h:2047
uint32_t entry
Definition: isohybrid.c:63
__u16 time
Definition: mkdosfs.c:8
static PVOID ptr
Definition: dispmode.c:27
NTSTATUS NTAPI NtSetEvent(IN HANDLE EventHandle, OUT PLONG PreviousState OPTIONAL)
Definition: event.c:455
#define LIST_FOR_EACH(cursor, list)
Definition: list.h:188
__WINE_SERVER_LIST_INLINE void list_add_before(struct list *elem, struct list *to_add)
Definition: list.h:87
#define EXPIRE_NEVER
Definition: timerqueue.c:64
Definition: list.h:15
ULONGLONG expire
Definition: timerqueue.c:49
#define LIST_ENTRY(type)
Definition: queue.h:175

Referenced by queue_move_timer(), and RtlCreateTimer().

◆ queue_current_time()

static ULONGLONG queue_current_time ( void  )
inlinestatic

Definition at line 107 of file timerqueue.c.

108{
109 LARGE_INTEGER now, freq;
111 return now.QuadPart * 1000 / freq.QuadPart;
112}
time_t now
Definition: finger.c:65
NTSTATUS NTAPI NtQueryPerformanceCounter(OUT PLARGE_INTEGER PerformanceCounter, OUT PLARGE_INTEGER PerformanceFrequency OPTIONAL)
Definition: profile.c:272
LONGLONG QuadPart
Definition: typedefs.h:114

Referenced by queue_get_timeout(), queue_timer_expire(), RtlCreateTimer(), and RtlUpdateTimer().

◆ queue_destroy_timer()

static void queue_destroy_timer ( struct queue_timer t)
static

Definition at line 258 of file timerqueue.c.

259{
260 /* We MUST hold the queue cs while calling this function. */
261 t->destroy = TRUE;
262 if (t->runcount == 0)
263 /* Ensure a timer is promptly removed. If callbacks are pending,
264 it will be removed after the last one finishes by the callback
265 cleanup wrapper. */
267 else
268 /* Make sure no destroyed timer masks an active timer at the head
269 of the sorted list. */
271}
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
static void queue_move_timer(struct queue_timer *t, ULONGLONG time, BOOL set_event)
Definition: timerqueue.c:140
static void queue_remove_timer(struct queue_timer *t)
Definition: timerqueue.c:67

Referenced by RtlDeleteTimer(), and RtlDeleteTimerQueueEx().

◆ queue_get_timeout()

static ULONG queue_get_timeout ( struct timer_queue q)
static

Definition at line 193 of file timerqueue.c.

194{
195 struct queue_timer *t;
197
199 if (list_head(&q->timers))
200 {
201 t = LIST_ENTRY(list_head(&q->timers), struct queue_timer, entry);
202 assert(!t->destroy || t->expire == EXPIRE_NEVER);
203
204 if (t->expire != EXPIRE_NEVER)
205 {
207 timeout = t->expire < time ? 0 : (ULONG)(t->expire - time);
208 }
209 }
211
212 return timeout;
213}
NTSYSAPI NTSTATUS NTAPI RtlEnterCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)
NTSYSAPI NTSTATUS NTAPI RtlLeaveCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)
static ULONGLONG queue_current_time(void)
Definition: timerqueue.c:107
uint32_t ULONG
Definition: typedefs.h:59

Referenced by timer_queue_thread_proc().

◆ queue_move_timer()

static void queue_move_timer ( struct queue_timer t,
ULONGLONG  time,
BOOL  set_event 
)
inlinestatic

Definition at line 140 of file timerqueue.c.

142{
143 /* We MUST hold the queue cs while calling this function. */
144 list_remove(&t->entry);
145 queue_add_timer(t, time, set_event);
146}
static void list_remove(struct list_entry *entry)
Definition: list.h:90
static void queue_add_timer(struct queue_timer *t, ULONGLONG time, BOOL set_event)
Definition: timerqueue.c:114

Referenced by queue_destroy_timer(), queue_timer_expire(), and RtlUpdateTimer().

◆ queue_remove_timer()

static void queue_remove_timer ( struct queue_timer t)
static

Definition at line 67 of file timerqueue.c.

68{
69 /* We MUST hold the queue cs while calling this function. This ensures
70 that we cannot queue another callback for this timer. The runcount
71 being zero makes sure we don't have any already queued. */
72 struct timer_queue *q = t->q;
73
74 assert(t->runcount == 0);
75 assert(t->destroy);
76
77 list_remove(&t->entry);
78 if (t->event)
79 NtSetEvent(t->event, NULL);
80 RtlFreeHeap(RtlGetProcessHeap(), 0, t);
81
82 if (q->quit && list_empty(&q->timers))
83 NtSetEvent(q->event, NULL);
84}
static int list_empty(struct list_entry *head)
Definition: list.h:58
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:608

Referenced by queue_destroy_timer(), and timer_cleanup_callback().

◆ queue_timer_expire()

static void queue_timer_expire ( struct timer_queue q)
static

Definition at line 148 of file timerqueue.c.

149{
150 struct queue_timer *t = NULL;
151
153 if (list_head(&q->timers))
154 {
156 t = LIST_ENTRY(list_head(&q->timers), struct queue_timer, entry);
157 if (!t->destroy && t->expire <= ((now = queue_current_time())))
158 {
159 ++t->runcount;
160 if (t->period)
161 {
162 next = t->expire + t->period;
163 /* avoid trigger cascade if overloaded / hibernated */
164 if (next < now)
165 next = now + t->period;
166 }
167 else
170 }
171 else
172 t = NULL;
173 }
175
176 if (t)
177 {
178 if (t->flags & WT_EXECUTEINTIMERTHREAD)
180 else
181 {
183 = (t->flags
187 if (status != STATUS_SUCCESS)
189 }
190 }
191}
GLbitfield flags
Definition: glext.h:7161
NTSYSAPI NTSTATUS NTAPI RtlQueueWorkItem(_In_ WORKERCALLBACKFUNC Function, _In_opt_ PVOID Context, _In_ ULONG Flags)
static unsigned __int64 next
Definition: rand_nt.c:6
static VOID WINAPI timer_callback_wrapper(LPVOID p)
Definition: timerqueue.c:100
static void timer_cleanup_callback(struct queue_timer *t)
Definition: timerqueue.c:86
#define WT_TRANSFER_IMPERSONATION
Definition: winnt_old.h:1047
#define WT_EXECUTEINPERSISTENTTHREAD
Definition: winnt_old.h:1046
#define WT_EXECUTEINIOTHREAD
Definition: winnt_old.h:1039
#define WT_EXECUTELONGFUNCTION
Definition: winnt_old.h:1043
#define WT_EXECUTEINTIMERTHREAD
Definition: winnt_old.h:1044

Referenced by timer_queue_thread_proc().

◆ RtlCancelTimer()

NTSTATUS NTAPI RtlCancelTimer ( HANDLE  TimerQueue,
HANDLE  Timer 
)

Definition at line 585 of file timerqueue.c.

586{
587 return RtlDeleteTimer(TimerQueue, Timer, NULL);
588}
NTSYSAPI NTSTATUS NTAPI RtlDeleteTimer(_In_ HANDLE TimerQueue, _In_ HANDLE Timer, _In_ HANDLE CompletionEvent)

◆ RtlCreateTimer()

NTSTATUS WINAPI RtlCreateTimer ( HANDLE  TimerQueue,
PHANDLE  NewTimer,
WAITORTIMERCALLBACKFUNC  Callback,
PVOID  Parameter,
DWORD  DueTime,
DWORD  Period,
ULONG  Flags 
)

Definition at line 425 of file timerqueue.c.

429{
431 struct queue_timer *t;
432 struct timer_queue *q = get_timer_queue(TimerQueue);
433
434 if (!q) return STATUS_NO_MEMORY;
435 if (q->magic != TIMER_QUEUE_MAGIC) return STATUS_INVALID_HANDLE;
436
437 t = RtlAllocateHeap(RtlGetProcessHeap(), 0, sizeof *t);
438 if (!t)
439 return STATUS_NO_MEMORY;
440
441 t->q = q;
442 t->runcount = 0;
443 t->callback = Callback;
444 t->param = Parameter;
445 t->period = Period;
446 t->flags = Flags;
447 t->destroy = FALSE;
448 t->event = NULL;
449
452 if (q->quit)
454 else
457
458 if (status == STATUS_SUCCESS)
459 *NewTimer = t;
460 else
461 RtlFreeHeap(RtlGetProcessHeap(), 0, t);
462
463 return status;
464}
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:590
#define STATUS_INVALID_HANDLE
Definition: ntstatus.h:245
#define STATUS_NO_MEMORY
Definition: ntstatus.h:260
#define TIMER_QUEUE_MAGIC
Definition: timerqueue.c:65
static struct timer_queue * get_timer_queue(HANDLE TimerQueue)
Definition: timerqueue.c:375
_In_ WDFINTERRUPT _In_ PFN_WDF_INTERRUPT_SYNCHRONIZE Callback
Definition: wdfinterrupt.h:458
_In_ WDFTIMER _In_ LONGLONG DueTime
Definition: wdftimer.h:190
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
_In_ LARGE_INTEGER _In_ ULONG Period
Definition: kefuncs.h:1313
_Inout_opt_ PVOID Parameter
Definition: rtltypes.h:323

◆ RtlCreateTimerQueue()

NTSTATUS WINAPI RtlCreateTimerQueue ( PHANDLE  NewTimerQueue)

Definition at line 285 of file timerqueue.c.

286{
288 struct timer_queue *q = RtlAllocateHeap(RtlGetProcessHeap(), 0, sizeof *q);
289 if (!q)
290 return STATUS_NO_MEMORY;
291
293 list_init(&q->timers);
294 q->quit = FALSE;
295 q->magic = TIMER_QUEUE_MAGIC;
297 if (status != STATUS_SUCCESS)
298 {
299 RtlFreeHeap(RtlGetProcessHeap(), 0, q);
300 return status;
301 }
303 if (status != STATUS_SUCCESS)
304 {
305 NtClose(q->event);
306 RtlFreeHeap(RtlGetProcessHeap(), 0, q);
307 return status;
308 }
309
310 NtResumeThread(q->thread, NULL);
311 *NewTimerQueue = q;
312 return STATUS_SUCCESS;
313}
static void list_init(struct list_entry *head)
Definition: list.h:51
#define EVENT_ALL_ACCESS
Definition: isotest.c:82
NTSYSAPI NTSTATUS NTAPI RtlInitializeCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3402
@ SynchronizationEvent
NTSTATUS NTAPI NtCreateEvent(OUT PHANDLE EventHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL, IN EVENT_TYPE EventType, IN BOOLEAN InitialState)
Definition: event.c:96
NTSTATUS NTAPI NtResumeThread(IN HANDLE ThreadHandle, OUT PULONG SuspendCount OPTIONAL)
Definition: state.c:290
static DWORD WINAPI timer_queue_thread_proc(LPVOID p)
Definition: timerqueue.c:215
PRTL_START_POOL_THREAD RtlpStartThreadFunc
Definition: workitem.c:45

Referenced by BasepCreateDefaultTimerQueue(), CreateTimerQueue(), and get_timer_queue().

◆ RtlDeleteTimer()

NTSTATUS WINAPI RtlDeleteTimer ( HANDLE  TimerQueue,
HANDLE  Timer,
HANDLE  CompletionEvent 
)

Definition at line 540 of file timerqueue.c.

542{
543 struct queue_timer *t = Timer;
544 struct timer_queue *q;
546 HANDLE event = NULL;
547
548 if (!Timer)
550 q = t->q;
551 if (CompletionEvent == INVALID_HANDLE_VALUE)
552 {
554 if (status == STATUS_SUCCESS)
556 }
557 else if (CompletionEvent)
558 event = CompletionEvent;
559
561 t->event = event;
562 if (t->runcount == 0 && event)
566
567 if (CompletionEvent == INVALID_HANDLE_VALUE && event)
568 {
569 if (status == STATUS_PENDING)
570 {
573 }
574 NtClose(event);
575 }
576
577 return status;
578}
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
struct _cl_event * event
Definition: glext.h:7739
NTSYSAPI NTSTATUS NTAPI NtWaitForSingleObject(IN HANDLE hObject, IN BOOLEAN bAlertable, IN PLARGE_INTEGER Timeout)
#define STATUS_PENDING
Definition: ntstatus.h:82
#define STATUS_INVALID_PARAMETER_1
Definition: ntstatus.h:475
static void queue_destroy_timer(struct queue_timer *t)
Definition: timerqueue.c:258

◆ RtlDeleteTimerQueue()

NTSTATUS NTAPI RtlDeleteTimerQueue ( HANDLE  TimerQueue)

Definition at line 595 of file timerqueue.c.

596{
598}

◆ RtlDeleteTimerQueueEx()

NTSTATUS WINAPI RtlDeleteTimerQueueEx ( HANDLE  TimerQueue,
HANDLE  CompletionEvent 
)

Definition at line 331 of file timerqueue.c.

332{
333 struct timer_queue *q = TimerQueue;
334 struct queue_timer *t, *temp;
337
338 if (!q || q->magic != TIMER_QUEUE_MAGIC)
340
341 thread = q->thread;
342
344 q->quit = TRUE;
345 if (list_head(&q->timers))
346 /* When the last timer is removed, it will signal the timer thread to
347 exit... */
348 LIST_FOR_EACH_ENTRY_SAFE(t, temp, &q->timers, struct queue_timer, entry)
350 else
351 /* However if we have none, we must do it ourselves. */
352 NtSetEvent(q->event, NULL);
354
355 if (CompletionEvent == INVALID_HANDLE_VALUE)
356 {
359 }
360 else
361 {
362 if (CompletionEvent)
363 {
364 DPRINT1("asynchronous return on completion event unimplemented\n");
366 NtSetEvent(CompletionEvent, NULL);
367 }
369 }
370
372 return status;
373}
#define DPRINT1
Definition: precomp.h:8
static HANDLE thread
Definition: service.c:33
static calc_node_t temp
Definition: rpn_ieee.c:38
#define LIST_FOR_EACH_ENTRY_SAFE(cursor, cursor2, list, type, field)
Definition: list.h:204

◆ RtlpInitializeTimerThread()

NTSTATUS RtlpInitializeTimerThread ( VOID  )

Definition at line 27 of file timerqueue.c.

28{
30}
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:239

Referenced by RtlpQueueWorkerThread().

◆ RtlSetTimer()

NTSTATUS WINAPI RtlSetTimer ( HANDLE  TimerQueue,
PHANDLE  NewTimer,
WAITORTIMERCALLBACKFUNC  Callback,
PVOID  Parameter,
DWORD  DueTime,
DWORD  Period,
ULONG  Flags 
)

Definition at line 468 of file timerqueue.c.

476{
477 return RtlCreateTimer(TimerQueue,
478 NewTimer,
479 Callback,
480 Parameter,
481 DueTime,
482 Period,
483 Flags);
484}
NTSYSAPI NTSTATUS NTAPI RtlCreateTimer(_In_ HANDLE TimerQueue, _In_ PHANDLE phNewTimer, _In_ WAITORTIMERCALLBACKFUNC Callback, _In_ PVOID Parameter, _In_ ULONG DueTime, _In_ ULONG Period, _In_ ULONG Flags)

◆ RtlUpdateTimer()

NTSTATUS WINAPI RtlUpdateTimer ( HANDLE  TimerQueue,
HANDLE  Timer,
DWORD  DueTime,
DWORD  Period 
)

Definition at line 504 of file timerqueue.c.

506{
507 struct queue_timer *t = Timer;
508 struct timer_queue *q = t->q;
509
511 /* Can't change a timer if it was once-only or destroyed. */
512 if (t->expire != EXPIRE_NEVER)
513 {
514 t->period = Period;
516 }
518
519 return STATUS_SUCCESS;
520}

◆ timer_callback_wrapper()

static VOID WINAPI timer_callback_wrapper ( LPVOID  p)
static

Definition at line 100 of file timerqueue.c.

101{
102 struct queue_timer *t = p;
103 t->callback(t->param, TRUE);
105}

Referenced by queue_timer_expire().

◆ timer_cleanup_callback()

static void timer_cleanup_callback ( struct queue_timer t)
static

Definition at line 86 of file timerqueue.c.

87{
88 struct timer_queue *q = t->q;
90
91 assert(0 < t->runcount);
92 --t->runcount;
93
94 if (t->destroy && t->runcount == 0)
96
98}

Referenced by queue_timer_expire(), and timer_callback_wrapper().

◆ timer_queue_thread_proc()

static DWORD WINAPI timer_queue_thread_proc ( LPVOID  p)
static

Definition at line 215 of file timerqueue.c.

216{
217 struct timer_queue *q = p;
218 ULONG timeout_ms;
219
220 timeout_ms = INFINITE;
221 for (;;)
222 {
225 BOOL done = FALSE;
226
228 q->event, FALSE, get_nt_timeout(&timeout, timeout_ms));
229
230 if (status == STATUS_WAIT_0)
231 {
232 /* There are two possible ways to trigger the event. Either
233 we are quitting and the last timer got removed, or a new
234 timer got put at the head of the list so we need to adjust
235 our timeout. */
237 if (q->quit && list_empty(&q->timers))
238 done = TRUE;
240 }
241 else if (status == STATUS_TIMEOUT)
243
244 if (done)
245 break;
246
247 timeout_ms = queue_get_timeout(q);
248 }
249
250 NtClose(q->event);
252 q->magic = 0;
253 RtlFreeHeap(RtlGetProcessHeap(), 0, q);
255 return 0;
256}
unsigned int BOOL
Definition: ntddk_ex.h:94
NTSYSAPI NTSTATUS NTAPI RtlDeleteCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)
#define STATUS_TIMEOUT
Definition: ntstatus.h:81
#define STATUS_WAIT_0
Definition: ntstatus.h:237
static PLARGE_INTEGER get_nt_timeout(PLARGE_INTEGER pTime, ULONG timeout)
Definition: timerqueue.c:32
static ULONG queue_get_timeout(struct timer_queue *q)
Definition: timerqueue.c:193
PRTL_EXIT_POOL_THREAD RtlpExitThreadFunc
Definition: workitem.c:46
static void queue_timer_expire(struct timer_queue *q)
Definition: timerqueue.c:148

Referenced by RtlCreateTimerQueue().

Variable Documentation

◆ RtlpExitThreadFunc

◆ RtlpStartThreadFunc

PRTL_START_POOL_THREAD RtlpStartThreadFunc
extern

◆ TimerThreadHandle

HANDLE TimerThreadHandle = NULL

Definition at line 24 of file timerqueue.c.

Referenced by RtlpQueueWorkerThread().