mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
-Dereference thread
-Reduce/fix handle-less-timer bitmap svn path=/trunk/; revision=4740
This commit is contained in:
parent
e76a3a5ab0
commit
5882d8441a
1 changed files with 10 additions and 8 deletions
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: timer.c,v 1.2 2003/05/18 17:16:17 ea Exp $
|
/* $Id: timer.c,v 1.3 2003/05/22 02:07:22 gdalsnes Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -43,6 +43,8 @@
|
||||||
|
|
||||||
/* GLOBALS *******************************************************************/
|
/* GLOBALS *******************************************************************/
|
||||||
|
|
||||||
|
//windows 2000 has room for 32768 handle-less timers
|
||||||
|
#define NUM_HANDLE_LESS_TIMERS 1024
|
||||||
|
|
||||||
static FAST_MUTEX Mutex;
|
static FAST_MUTEX Mutex;
|
||||||
static LIST_ENTRY TimerListHead;
|
static LIST_ENTRY TimerListHead;
|
||||||
|
@ -313,12 +315,10 @@ TimerThreadMain(VOID)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* FIXME: small window here, where the thread can exit between the thread lookup
|
|
||||||
* and the message posting (missing ref count?)
|
|
||||||
*/
|
|
||||||
MsqPostMessage(((PW32THREAD)Thread->Win32Thread)->MessageQueue, MsqCreateMessage(&MsgTimer->Msg));
|
MsqPostMessage(((PW32THREAD)Thread->Win32Thread)->MessageQueue, MsqCreateMessage(&MsgTimer->Msg));
|
||||||
|
|
||||||
|
ObDereferenceObject(Thread);
|
||||||
|
|
||||||
//set up next periodic timeout
|
//set up next periodic timeout
|
||||||
MsgTimer->Timeout.QuadPart += (MsgTimer->Period * 10000);
|
MsgTimer->Timeout.QuadPart += (MsgTimer->Period * 10000);
|
||||||
InsertTimerAscendingOrder(MsgTimer);
|
InsertTimerAscendingOrder(MsgTimer);
|
||||||
|
@ -349,16 +349,18 @@ NTSTATUS FASTCALL
|
||||||
InitTimerImpl(VOID)
|
InitTimerImpl(VOID)
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
ULONG BitmapBytes;
|
||||||
|
|
||||||
|
BitmapBytes = ROUND_UP(NUM_HANDLE_LESS_TIMERS, sizeof(ULONG) * 8) / 8;
|
||||||
|
|
||||||
InitializeListHead(&TimerListHead);
|
InitializeListHead(&TimerListHead);
|
||||||
KeInitializeTimer(&Timer);
|
KeInitializeTimer(&Timer);
|
||||||
ExInitializeFastMutex(&Mutex);
|
ExInitializeFastMutex(&Mutex);
|
||||||
|
|
||||||
//windows 2000 has room for 32768 handle-less timers
|
HandleLessTimersBitMapBuffer = ExAllocatePool(PagedPool, BitmapBytes);
|
||||||
HandleLessTimersBitMapBuffer = ExAllocatePool(PagedPool, PAGE_SIZE);
|
|
||||||
RtlInitializeBitMap(&HandleLessTimersBitMap,
|
RtlInitializeBitMap(&HandleLessTimersBitMap,
|
||||||
HandleLessTimersBitMapBuffer,
|
HandleLessTimersBitMapBuffer,
|
||||||
PAGE_SIZE * sizeof(ULONG));
|
BitmapBytes * 8);
|
||||||
|
|
||||||
//yes we need this, since ExAllocatePool isn't supposed to zero out allocated memory
|
//yes we need this, since ExAllocatePool isn't supposed to zero out allocated memory
|
||||||
RtlClearAllBits(&HandleLessTimersBitMap);
|
RtlClearAllBits(&HandleLessTimersBitMap);
|
||||||
|
|
Loading…
Reference in a new issue