X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=KernelLand%2FKernel%2Fsemaphore.c;h=2c9fc94b47303e90f0ffe6827f5e9256cb1a6c81;hb=04a050f42807686dc119838c82372409246d55bb;hp=d4583e7491f06cf9d22e14a6f1ebe36e3fb19122;hpb=48743e39650eb1ef988380e9d95f27fd40d3a9ce;p=tpg%2Facess2.git diff --git a/KernelLand/Kernel/semaphore.c b/KernelLand/Kernel/semaphore.c index d4583e74..2c9fc94b 100644 --- a/KernelLand/Kernel/semaphore.c +++ b/KernelLand/Kernel/semaphore.c @@ -33,6 +33,7 @@ int Semaphore_Wait(tSemaphore *Sem, int MaxToTake) if( MaxToTake < 0 ) { Log_Warning("Threads", "Semaphore_Wait: User bug - MaxToTake(%i) < 0, Sem=%p(%s)", MaxToTake, Sem, Sem->Name); + MaxToTake = 0; } SHORTLOCK( &Sem->Protector ); @@ -126,10 +127,8 @@ int Semaphore_Wait(tSemaphore *Sem, int MaxToTake) toWake->RetStatus = given; // Wake the sleeper - SHORTLOCK( &glThreadListLock ); if( toWake->Status != THREAD_STAT_ACTIVE ) Threads_AddActive(toWake); - SHORTREL( &glThreadListLock ); } SHORTREL( &Sem->Protector );