Merge branch 'master' of git://localhost/acess2
[tpg/acess2.git] / KernelLand / Kernel / semaphore.c
index d4583e7..2c9fc94 100644 (file)
@@ -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 );
        

UCC git Repository :: git.ucc.asn.au