Logo Search packages:      
Sourcecode: virtualbox-ose version File versions  Download package

int kLdrDyldSemRequest ( void   ) 

Requests the loader sempahore ownership. This can be done recursivly.

Returns:
0 on success, non-zero OS status code on failure.

Definition at line 140 of file kLdrDyldSem.c.

References g_Semaphore.

Referenced by kLdrDyldFindByAddress(), kLdrDyldFindByName(), kLdrDyldGetFilename(), kLdrDyldGetName(), kLdrDyldLoad(), kLdrDyldLoadExe(), kLdrDyldQuerySymbol(), and kLdrDyldUnload().

{
#if K_OS == K_OS_DARWIN
    /* not sure about this... */
    kern_return_t krc;
    do krc = semaphore_wait(g_Semaphore);
    while (krc == KERN_ABORTED);
    if (krc == KERN_SUCCESS)
        return 0;
    return krc;

#elif K_OS == K_OS_OS2
    APIRET rc = DosRequestMutexSem(g_hmtx, 5000);
    if (rc == ERROR_TIMEOUT || rc == ERROR_SEM_TIMEOUT || rc == ERROR_INTERRUPT)
    {
        unsigned i = 0;
        do
        {
            /** @todo check for deadlocks etc. */
            rc = DosRequestMutexSem(g_hmtx, 1000);
        } while (   (   rc == ERROR_TIMEOUT
                     || rc == ERROR_SEM_TIMEOUT
                     || rc == ERROR_INTERRUPT)
                 && i++ < 120);
    }
    return rc;

#elif  K_OS == K_OS_WINDOWS
    EnterCriticalSection(&g_CritSect);
    return 0;

#else
# error "port me"
#endif
}


Generated by  Doxygen 1.6.0   Back to index