mirror of
https://github.com/reactos/reactos.git
synced 2025-02-25 01:39:30 +00:00
utilize sorted list macros
svn path=/trunk/; revision=6523
This commit is contained in:
parent
d58f64745b
commit
3a348fb5fb
1 changed files with 11 additions and 49 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.15 2003/10/22 19:02:13 weiden Exp $
|
/* $Id: timer.c,v 1.16 2003/11/03 20:31:39 gdalsnes Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -69,55 +69,17 @@ static CLIENT_ID MsgTimerThreadId;
|
||||||
BOOL FASTCALL
|
BOOL FASTCALL
|
||||||
IntInsertTimerAscendingOrder(PMSG_TIMER_ENTRY NewTimer, BOOL SysTimer)
|
IntInsertTimerAscendingOrder(PMSG_TIMER_ENTRY NewTimer, BOOL SysTimer)
|
||||||
{
|
{
|
||||||
PLIST_ENTRY EnumEntry, InsertAfter;
|
PLIST_ENTRY ListHead;
|
||||||
PMSG_TIMER_ENTRY MsgTimer;
|
|
||||||
|
|
||||||
InsertAfter = NULL;
|
ListHead = SysTimer ? &SysTimerListHead : &TimerListHead;
|
||||||
|
|
||||||
if(!SysTimer)
|
InsertAscendingList(ListHead,
|
||||||
{
|
&NewTimer->ListEntry,
|
||||||
EnumEntry = TimerListHead.Flink;
|
MSG_TIMER_ENTRY,
|
||||||
while (EnumEntry != &TimerListHead)
|
ListEntry,
|
||||||
{
|
Timeout.QuadPart);
|
||||||
MsgTimer = CONTAINING_RECORD(EnumEntry, MSG_TIMER_ENTRY, ListEntry);
|
|
||||||
if (NewTimer->Timeout.QuadPart > MsgTimer->Timeout.QuadPart)
|
return IsFirstEntry(ListHead, &NewTimer->ListEntry);
|
||||||
{
|
|
||||||
InsertAfter = EnumEntry;
|
|
||||||
}
|
|
||||||
EnumEntry = EnumEntry->Flink;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (InsertAfter)
|
|
||||||
{
|
|
||||||
InsertTailList(InsertAfter, &NewTimer->ListEntry);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
//insert as first entry
|
|
||||||
InsertHeadList(&TimerListHead, &NewTimer->ListEntry);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
EnumEntry = SysTimerListHead.Flink;
|
|
||||||
while (EnumEntry != &SysTimerListHead)
|
|
||||||
{
|
|
||||||
MsgTimer = CONTAINING_RECORD(EnumEntry, MSG_TIMER_ENTRY, ListEntry);
|
|
||||||
if (NewTimer->Timeout.QuadPart > MsgTimer->Timeout.QuadPart)
|
|
||||||
{
|
|
||||||
InsertAfter = EnumEntry;
|
|
||||||
}
|
|
||||||
EnumEntry = EnumEntry->Flink;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (InsertAfter)
|
|
||||||
{
|
|
||||||
InsertTailList(InsertAfter, &NewTimer->ListEntry);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
//insert as first entry
|
|
||||||
InsertHeadList(&SysTimerListHead, &NewTimer->ListEntry);
|
|
||||||
}
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//must hold mutex while calling this
|
//must hold mutex while calling this
|
||||||
|
|
Loading…
Reference in a new issue