public virtual void step() { ThreadManForUser threadMan = Modules.ThreadManForUserModule; for (int?thid = deferredThreadWakeupQueue.poll(); thid != null; thid = deferredThreadWakeupQueue.poll()) { //if (log.DebugEnabled) { Console.WriteLine("really waking thread " + thid.ToString("x") + "(" + threadMan.getThreadName(thid.Value) + ")"); } threadMan.hleUnblockThread(thid); ExternalGE.onGeStopWaitList(); } }
public virtual void put(K key, V value) { if (key == default(K) || value == default(V)) { throw new System.NullReferenceException(); } V previousValue = cache.put(key, value); if (previousValue != default(V)) { keys.remove(key); } keys.add(key); if (cache.size() > capacity) { K lruKey = keys.poll(); if (lruKey != default(K)) { cache.remove(lruKey); // remove duplicated keys this.removeAll(lruKey); // queue may not contain any key of a possibly concurrently added entry of the same key in the cache if (cache.containsKey(lruKey)) { keys.add(lruKey); } } } }
/* ---- many producers ---- */ public override void Produce(T t) { _queue.add(t); int newSize = _size.incrementAndGet(); if (newSize > _maxSize) { _queue.poll(); _size.decrementAndGet(); } }
public static void finishList(PspGeList list) { Modules.sceGe_userModule.hleGeListSyncDone(list); lock (drawListQueue) { if (list == currentList) { if (CaptureManager.captureInProgress) { log.Level = logLevel; NativeUtils.DumpFrames = false; NativeUtils.DumpTextures = false; NativeUtils.setLogLevel(); CaptureManager.captureInProgress = false; Emulator.PauseEmu(); } // Restore the context to the state at the beginning of the list processing (used by sceGu). if (list.hasSaveContextAddr()) { restoreContext(list.SaveContextAddr); } currentList = null; } else { drawListQueue.remove(list); } } if (currentList == null) { startList(drawListQueue.poll()); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: public int hleGeListEnQueue(pspsharp.HLE.TPointer listAddr, @CanBeNull pspsharp.HLE.TPointer stallAddr, int cbid, @CanBeNull pspsharp.HLE.TPointer argAddr, int saveContextAddr, bool enqueueHead) public virtual int hleGeListEnQueue(TPointer listAddr, TPointer stallAddr, int cbid, TPointer argAddr, int saveContextAddr, bool enqueueHead) { pspGeListOptParam optParams = null; int stackAddr = 0; if (argAddr.NotNull) { optParams = new pspGeListOptParam(); optParams.read(argAddr); stackAddr = optParams.stackAddr; saveContextAddr = optParams.contextAddr; //if (log.DebugEnabled) { Console.WriteLine(string.Format("hleGeListEnQueue optParams={0}", optParams)); } } bool useCachedMemory = false; if (Modules.SysMemUserForUserModule.hleKernelGetCompiledSdkVersion() >= 0x02000000) { bool isBusy; if (ExternalGE.Active) { isBusy = ExternalGE.hasDrawList(listAddr.Address, stackAddr); } else { isBusy = VideoEngine.Instance.hasDrawList(listAddr.Address, stackAddr); } if (isBusy) { Console.WriteLine(string.Format("hleGeListEnQueue can't enqueue duplicate list address {0}, stack 0x{1:X8}", listAddr, stackAddr)); return(SceKernelErrors.ERROR_BUSY); } } else { // Old games (i.e. having PSP SDK version < 2.00) are sometimes // reusing the same address for multiple lists, without waiting // for the previous list to complete. They assume that the lists // are being executed quite quickly, which is not the case when // using the OpenGL rendering engine. There is some delay before // the OpenGL frame refresh is being processed. useCachedMemory = true; } // No need to cache any memory when using the external software renderer if (ExternalGE.Active) { useCachedMemory = false; } int result; lock (this) { PspGeList list = listFreeQueue.poll(); if (list == null) { Console.WriteLine("hleGeListEnQueue no more free list available!"); //if (log.DebugEnabled) { for (int i = 0; i < NUMBER_GE_LISTS; i++) { Console.WriteLine(string.Format("List#{0:D}: {1}", i, allGeLists[i])); } } return(SceKernelErrors.ERROR_OUT_OF_MEMORY); } list.init(listAddr.Address, stallAddr.Address, cbid, optParams); list.SaveContextAddr = saveContextAddr; if (useCachedMemory) { setStallAddressWithCachedMemory(list, stallAddr.Address); } if (enqueueHead) { // Send the list to the VideoEngine at the head of the queue. list.startListHead(); } else { // Send the list to the VideoEngine before triggering the display (setting GE dirty) list.startList(); } Modules.sceDisplayModule.GeDirty = true; result = list.id; } //if (log.DebugEnabled) { Console.WriteLine(string.Format("hleGeListEnQueue returning 0x{0:X}", result)); } return(result); }