[RTL]
[reactos.git] / lib / rtl / timerqueue.c
index 3a8cb67..f3e3fcc 100644 (file)
@@ -19,8 +19,6 @@
 
 /* FUNCTIONS ***************************************************************/
 
-typedef VOID (CALLBACK *WAITORTIMERCALLBACKFUNC) (PVOID, BOOLEAN );
-
 HANDLE TimerThreadHandle = NULL;
 
 NTSTATUS
@@ -241,6 +239,7 @@ static void WINAPI timer_queue_thread_proc(LPVOID p)
     NtClose(q->event);
     RtlDeleteCriticalSection(&q->cs);
     RtlFreeHeap(RtlGetProcessHeap(), 0, q);
+    RtlExitUserThread(STATUS_SUCCESS);
 }
 
 static void queue_destroy_timer(struct queue_timer *t)
@@ -373,7 +372,7 @@ static struct timer_queue *get_timer_queue(HANDLE TimerQueue)
             NTSTATUS status = RtlCreateTimerQueue(&q);
             if (status == STATUS_SUCCESS)
             {
-                PVOID p = _InterlockedCompareExchangePointer(
+                PVOID p = InterlockedCompareExchangePointer(
                     (void **) &default_timer_queue, q, NULL);
                 if (p)
                     /* Got beat to the punch.  */
@@ -507,10 +506,13 @@ NTSTATUS WINAPI RtlDeleteTimer(HANDLE TimerQueue, HANDLE Timer,
                                HANDLE CompletionEvent)
 {
     struct queue_timer *t = Timer;
-    struct timer_queue *q = t->q;
+    struct timer_queue *q;
     NTSTATUS status = STATUS_PENDING;
     HANDLE event = NULL;
 
+    if (!Timer)
+        return STATUS_INVALID_PARAMETER_1;
+    q = t->q;
     if (CompletionEvent == INVALID_HANDLE_VALUE)
         status = NtCreateEvent(&event, EVENT_ALL_ACCESS, NULL, FALSE, FALSE);
     else if (CompletionEvent)