work on semaphores.

svn path=/trunk/; revision=341
This commit is contained in:
jean 1999-03-25 13:53:45 +00:00
parent 42c50bfaa8
commit e4981e3a09

View file

@ -101,6 +101,8 @@ BOOLEAN KeDispatcherObjectWakeOne(DISPATCHER_HEADER* hdr)
WaitListEntry); WaitListEntry);
DPRINT("current_entry %x current %x\n",current_entry,current); DPRINT("current_entry %x current %x\n",current_entry,current);
DPRINT("Waking %x\n",current->Thread); DPRINT("Waking %x\n",current->Thread);
if (hdr->Type == SemaphoreType)
hdr->SignalState--;
PsResumeThread(CONTAINING_RECORD(current->Thread,ETHREAD,Tcb)); PsResumeThread(CONTAINING_RECORD(current->Thread,ETHREAD,Tcb));
return(TRUE); return(TRUE);
} }
@ -148,15 +150,19 @@ NTSTATUS KeWaitForSingleObject(PVOID Object,
KWAIT_BLOCK blk; KWAIT_BLOCK blk;
DPRINT("Entering KeWaitForSingleObject(Object %x)\n",Object); DPRINT("Entering KeWaitForSingleObject(Object %x)\n",Object);
// FIXME : if KeReleaseSemaphore called with wait just before KeWaitxxx
// we must do something special.
KeAcquireDispatcherDatabaseLock(FALSE); KeAcquireDispatcherDatabaseLock(FALSE);
if (hdr->SignalState) if (hdr->SignalState > 0)
{ {
if (hdr->Type == SynchronizationEvent) if (hdr->Type == SynchronizationEvent)
{ {
hdr->SignalState=FALSE; hdr->SignalState=FALSE;
} }
else if (hdr->Type == SemaphoreType)
hdr->SignalState--;
KeReleaseDispatcherDatabaseLock(FALSE); KeReleaseDispatcherDatabaseLock(FALSE);
return(STATUS_SUCCESS); return(STATUS_SUCCESS);
} }