Yield() public method

public Yield ( ) : void
return void
Ejemplo n.º 1
0
 public void waitThreadForever(CpuThreadState CpuThreadState)
 {
     var SleepThread = HleState.ThreadManager.Current;
     SleepThread.CurrentStatus = HleThread.Status.Waiting;
     SleepThread.CurrentWaitType = HleThread.WaitType.None;
     CpuThreadState.Yield();
 }
Ejemplo n.º 2
0
 public int sceKernelChangeThreadPriority(CpuThreadState CpuThreadState, int ThreadId, int Priority)
 {
     GetThreadById(ThreadId).PriorityValue = Priority;
     HleState.ThreadManager.Reschedule();
     CpuThreadState.Yield();
     //throw(new NotImplementedException());
     return 0;
 }
		public int sceKernelSignalSema(CpuThreadState CpuThreadState, SemaphoreId SemaphoreId, int Signal)
		{
			//Console.Error.WriteLine("sceKernelSignalSema!");
			var HleSemaphore = GetSemaphoreById(SemaphoreId);
			if (HleSemaphore.IncrementCount(Signal) > 0)
			{
				CpuThreadState.Yield();
			}
			return 0;
		}
Ejemplo n.º 4
0
        public int sceKernelDeleteSema(CpuThreadState CpuThreadState, SemaphoreId SemaphoreId)
        {
            var HleSemaphore = GetSemaphoreById(SemaphoreId);
            SemaphoreManager.Semaphores.Remove((int)SemaphoreId);
            if (HleSemaphore.IncrementCount(HleSemaphore.SceKernelSemaInfo.MaximumCount) > 0)
            {
                CpuThreadState.Yield();
            }

            return 0;
        }
Ejemplo n.º 5
0
        public int sceKernelPollSema(CpuThreadState CpuThreadState, SemaphoreId SemaphoreId, int Signal)
        {
            var Semaphore = GetSemaphoreById(SemaphoreId);
            if (Signal <= 0) throw(new SceKernelException(SceKernelErrors.ERROR_KERNEL_ILLEGAL_COUNT));
            if (Semaphore.CurrentCount - Signal < 0)
            {
                //ThreadManager.Reschedule();
                CpuThreadState.Yield();
                throw (new SceKernelException(SceKernelErrors.ERROR_KERNEL_SEMA_ZERO));
            }
            Semaphore.IncrementCount(-Signal);
            //throw(new NotImplementedException());
            return 0;
            /*
            try {
                PspSemaphore pspSemaphore = uniqueIdFactory.get!PspSemaphore(semaid);

                if (pspSemaphore.info.currentCount - signal < 0) return SceKernelErrors.ERROR_KERNEL_SEMA_ZERO;

                pspSemaphore.info.currentCount -= signal;
                return 0;
            } catch (UniqueIdNotFoundException) {
                return SceKernelErrors.ERROR_KERNEL_NOT_FOUND_SEMAPHORE;
            }
            */
        }
Ejemplo n.º 6
0
 public void finalizeCallback(CpuThreadState CpuThreadState)
 {
     CpuThreadState.CpuProcessor.RunningCallback = false;
     CpuThreadState.Yield();
     //throw (new HleEmulatorFinalizeCallbackException());
 }
Ejemplo n.º 7
0
		public int sceKernelRotateThreadReadyQueue(CpuThreadState CpuThreadState, int priority)
		{
			// @TODO!
			//throw(new NotImplementedException());
			CpuThreadState.Yield();
			return 0;
		}
Ejemplo n.º 8
0
		public int sceKernelChangeThreadPriority(CpuThreadState CpuThreadState, int ThreadId, int Priority)
		{
			var Thread = GetThreadById(ThreadId);
			Thread.PriorityValue = Priority;
			CpuThreadState.Yield();
			//throw(new NotImplementedException());
			return 0;
		}
Ejemplo n.º 9
0
		public int sceKernelStartThread(CpuThreadState CpuThreadState, int ThreadId, int UserDataLength, uint UserDataPointer)
		{
			var ThreadToStart = GetThreadById((int)ThreadId);
			_sceKernelStartThread(CpuThreadState, ThreadId, UserDataLength, UserDataPointer);
			// Schedule new thread?
			CpuThreadState.Yield();
			return 0;
		}
Ejemplo n.º 10
0
        public int sceKernelStartThread(CpuThreadState CpuThreadState, int ThreadId, uint ArgumentsLength, uint ArgumentsPointer)
        {
            var ThreadToStart = GetThreadById((int)ThreadId);
            //Console.WriteLine("LEN: {0:X}", ArgumentsLength);
            //Console.WriteLine("PTR: {0:X}", ArgumentsPointer);
            ThreadToStart.CpuThreadState.GPR[4] = (int)ArgumentsLength;
            ThreadToStart.CpuThreadState.GPR[5] = (int)ArgumentsPointer;
            ThreadToStart.CurrentStatus = HleThread.Status.Ready;

            // Schedule new thread?
            HleState.ThreadManager.ScheduleNext(ThreadToStart);
            CpuThreadState.Yield();
            return 0;
        }