void sslcExit(void) { if (AtomicDecrement(&__sslc_refcount)) return; svcCloseHandle(__sslc_servhandle); __sslc_servhandle = 0; }
void srvExit(void) { if (AtomicDecrement(&srvRefCount)) return; if (srvHandle != 0) svcCloseHandle(srvHandle); srvHandle = 0; }
~Instance() { ELock_lock(&m_prototype->m_interlock); if(!AtomicDecrement(&m_prototype->m_lock)) { m_prototype->m_tid = NULL; } ELock_unlock(&m_prototype->m_interlock); }
long CDVDVideoCodecIMXBuffer::Release() { long count = AtomicDecrement(&m_refs); #ifdef TRACE_FRAMES CLog::Log(LOGDEBUG, "R- %02d - ref : %d (VPU)\n", m_idx, count); #endif if (count == 2) { // Only referenced by the coded and its next frame, release the previous SAFE_RELEASE(m_previousBuffer); } if (count == 1) { // If count drops to 1 then the only reference is being held by the codec // that it can be released in the next Decode call. if(m_frameBuffer != NULL) { m_rendered = true; SAFE_RELEASE(m_previousBuffer); #ifdef TRACE_FRAMES CLog::Log(LOGDEBUG, "R %02d (VPU)\n", m_idx); #endif } } else if (count == 0) { delete this; } return count; }
void pxipmExit(void) { if (AtomicDecrement(&pxipmRefCount)) return; svcCloseHandle(pxipmHandle); }
HRESULT CTestAtomicHelpers::Run() { HRESULT hr = S_OK; int value = -2000; int nextexpected = -2000; int result = 0; while (value < 2000) { nextexpected++; result = AtomicIncrement(&value); ChkIf(result != nextexpected, E_UNEXPECTED); ChkIf(result != value, E_UNEXPECTED); } value = 2000; nextexpected = 2000; while (value > -2000) { nextexpected--; result = AtomicDecrement(&value); ChkIf(result != nextexpected, E_UNEXPECTED); ChkIf(result != value, E_UNEXPECTED); } Cleanup: return hr; }
Result pxiDevInit(void) { Result res; if (AtomicPostIncrement(&pxiDevRefCount)) return 0; res = srvGetServiceHandle(&pxiDevHandle, "pxi:dev"); if (R_FAILED(res)) AtomicDecrement(&pxiDevRefCount); return res; }
//! @brief Decrement the reference count //! @return True if that was the last reference. bool release( ) const { if( m_refCount == 0 ) throw new std::invalid_argument("Released an interned symbol too many times!"); return (AtomicDecrement( &m_refCount ) == 0); }
void testAtomicOps() { volatile esint32 key = 0; EAssert(AtomicIncrement(&key) == 1, "key != 1"); EAssert(AtomicDecrement(&key) == 0, "key != 0"); AtomicCompareExchange(1, 0, &key); EAssert(AtomicIncrement(&key) == 2, "key != 2"); }
Result ptmuxInit(void) { if (AtomicPostIncrement(&ptmuxRefCount)) return 0; Result res = srvGetServiceHandle(&ptmuxHandle, "ptm:u"); if (R_FAILED(res)) AtomicDecrement(&ptmuxRefCount); return res; }
Result hbInit(void) { Result res=0; if (AtomicPostIncrement(&hbRefCount)) return 0; res = srvGetServiceHandle(&hbHandle, "hb:HB"); if (R_FAILED(res)) AtomicDecrement(&hbRefCount); return res; }
Result psInit(void) { Result res; if (AtomicPostIncrement(&psRefCount)) return 0; res = srvGetServiceHandle(&psHandle, "ps:ps"); if (R_FAILED(res)) AtomicDecrement(&psRefCount); return res; }
Result gspLcdInit(void) { Result res=0; if (AtomicPostIncrement(&gspLcdRefCount)) return 0; res = srvGetServiceHandle(&gspLcdHandle, "gsp::Lcd"); if (R_FAILED(res)) AtomicDecrement(&gspLcdRefCount); return res; }
Result loaderInit(void) { Result res; if (AtomicPostIncrement(&loaderRefCount)) return 0; res = srvGetServiceHandle(&loaderHandle, "Loader"); if (R_FAILED(res)) AtomicDecrement(&loaderRefCount); return res; }
Result pmDbgInit(void) { Result res; if (AtomicPostIncrement(&pmDbgRefcount)) return 0; res = srvGetServiceHandle(&pmDbgHandle, "pm:dbg"); if (R_FAILED(res)) AtomicDecrement(&pmDbgRefcount); return res; }
Result miniSocInit() { if(AtomicPostIncrement(&miniSocRefCount)) return 0; u32 tmp = 0; Result ret = 0; bool isSocURegistered; ret = srvIsServiceRegistered(&isSocURegistered, "soc:U"); if(ret != 0) goto cleanup; if(!isSocURegistered) { ret = -1; goto cleanup; } ret = srvGetServiceHandle(&SOCU_handle, "soc:U"); if(ret != 0) goto cleanup; ret = svcControlMemory(&tmp, socContextAddr, 0, socContextSize, MEMOP_ALLOC, MEMPERM_READ | MEMPERM_WRITE); if(ret != 0) goto cleanup; socContextAddr = tmp; ret = svcCreateMemoryBlock(&socMemhandle, (u32)socContextAddr, socContextSize, 0, 3); if(ret != 0) goto cleanup; ret = SOCU_Initialize(socMemhandle, socContextSize); if(ret != 0) goto cleanup; svcKernelSetState(0x10000, 2); miniSocEnabled = true; return 0; cleanup: AtomicDecrement(&miniSocRefCount); if(socMemhandle != 0) { svcCloseHandle(socMemhandle); socMemhandle = 0; } if(SOCU_handle != 0) { SOCU_Shutdown(); svcCloseHandle(SOCU_handle); SOCU_handle = 0; } if(tmp != 0) svcControlMemory(&tmp, socContextAddr, socContextAddr, socContextSize, MEMOP_FREE, MEMPERM_DONTCARE); return ret; }
int CBasicRefCount::InternalRelease() { int refcount = AtomicDecrement(&m_nRefs); if (refcount == 0) { OnFinalRelease(); } return refcount; }
long CDVDMediaCodecInfo::Release() { //REPORT_FUNCTION(); long count = AtomicDecrement(&m_refs); if (count == 1) ReleaseOutputBuffer(false); if (count == 0) delete this; return count; }
static Result _psInit(Handle handle) { Result res=0; if (AtomicPostIncrement(&psRefCount)) return 0; if(handle==0)res = srvGetServiceHandle(&handle, "ps:ps"); if (R_FAILED(res)) AtomicDecrement(&psRefCount); if (R_SUCCEEDED(res)) psHandle = handle; return res; }
long CDVDMsgGeneralSynchronize::Release() { CSingleLock lock(m_p->section); long count = AtomicDecrement(&m_refs); m_p->condition.notifyAll(); lock.Leave(); if (count == 0) delete this; return count; }
void Event::Stop(EventData& data) { data.Stop(); if (data.description->isSampling) { if (EventStorage* storage = Core::storage) AtomicDecrement(&storage->isSampling); } }
Result ndspInit(void) { Result rc = 0; if (AtomicPostIncrement(&ndspRefCount)) return 0; if (!componentBin && !ndspFindAndLoadComponent()) { rc = MAKERESULT(RL_PERMANENT, RS_NOTFOUND, 41, RD_NOT_FOUND); goto _fail0; } LightLock_Init(&ndspMutex); ndspInitMaster(); ndspiInitChn(); rc = cfguInit(); if (R_SUCCEEDED(rc)) { u8 outMode; rc = CFGU_GetConfigInfoBlk2(sizeof(outMode), 0x70001, &outMode); if (R_SUCCEEDED(rc)) ndspMaster.outputMode = outMode; cfguExit(); } rc = dspInit(); if (R_FAILED(rc)) return rc; rc = ndspInitialize(false); if (R_FAILED(rc)) goto _fail1; rc = svcCreateEvent(&sleepEvent, 0); if (R_FAILED(rc)) goto _fail2; ndspThread = threadCreate(ndspThreadMain, 0x0, NDSP_THREAD_STACK_SIZE, 0x18, -2, true); if (!ndspThread) goto _fail3; aptHook(&aptCookie, ndspAptHook, NULL); return 0; _fail3: svcCloseHandle(sleepEvent); _fail2: ndspFinalize(false); _fail1: dspExit(); if (componentFree) { free((void*)componentBin); componentBin = NULL; } _fail0: AtomicDecrement(&ndspRefCount); return rc; }
long CDVDMediaCodecInfo::Release() { long count = AtomicDecrement(&m_refs); if (count == 0) { ReleaseOutputBuffer(false); delete this; } return count; }
long CMMALVideoBuffer::Release() { long count = AtomicDecrement(&m_refs); if (g_advancedSettings.CanLogComponent(LOGVIDEO)) CLog::Log(LOGDEBUG, "%s::%s %p (%p) ref:%ld", CLASSNAME, __func__, this, mmal_buffer, count); if (count == 0) { m_omv->ReleaseBuffer(this); } return count; }
Result acInit(void) { Result ret; if (AtomicPostIncrement(&acRefCount)) return 0; ret = srvGetServiceHandle(&acHandle, "ac:u"); if(R_FAILED(ret)) ret = srvGetServiceHandle(&acHandle, "ac:i"); if(R_FAILED(ret)) AtomicDecrement(&acRefCount); return ret; }
Result cfguInit(void) { Result ret; if (AtomicPostIncrement(&cfguRefCount)) return 0; // cfg:i has the most commands, then cfg:s, then cfg:u ret = srvGetServiceHandle(&cfguHandle, "cfg:i"); if(R_FAILED(ret)) ret = srvGetServiceHandle(&cfguHandle, "cfg:s"); if(R_FAILED(ret)) ret = srvGetServiceHandle(&cfguHandle, "cfg:u"); if(R_FAILED(ret)) AtomicDecrement(&cfguRefCount); return ret; }
Result sslcInit(Handle session_handle) { Result ret=0; if (AtomicPostIncrement(&__sslc_refcount)) return 0; __sslc_servhandle = session_handle; if(__sslc_servhandle==0)ret = srvGetServiceHandle(&__sslc_servhandle, "ssl:C"); if(session_handle==0 && R_SUCCEEDED(ret))ret = sslcipc_Initialize(); if (R_FAILED(ret)) AtomicDecrement(&__sslc_refcount); return ret; }
long CYUVVideoBuffer::Release() { long count = AtomicDecrement(&m_refs); #ifdef MMAL_DEBUG_VERBOSE CLog::Log(LOGDEBUG, "%s::%s omvb:%p mmal:%p ref:%ld", CLASSNAME, __func__, this, mmal_buffer, count); #endif if (count == 0) { mmal_buffer_header_release(mmal_buffer); delete this; } else assert(count > 0); return count; }
Result amInit(void) { Result ret; if (AtomicPostIncrement(&amRefCount)) return 0; ret = srvGetServiceHandle(&amHandle, "am:net"); if (R_FAILED(ret)) ret = srvGetServiceHandle(&amHandle, "am:u"); if (R_FAILED(ret)) ret = srvGetServiceHandle(&amHandle, "am:sys"); if (R_FAILED(ret)) ret = srvGetServiceHandle(&amHandle, "am:app"); if (R_FAILED(ret)) AtomicDecrement(&amRefCount); return ret; }
Result pxipmInit(void) { Result ret = 0; if (AtomicPostIncrement(&pxipmRefCount)) return 0; ret = srvSysGetServiceHandle(&pxipmHandle, "PxiPM"); if (R_FAILED(ret)) AtomicDecrement(&pxipmRefCount); return ret; }